我创建了 Elasticsearch 索引,它有大约 350 个字段(包括嵌套字段),我只为其中的几个定义了映射。在调用 _update API 时,我遇到了 400 Bad request 的异常。
已超出索引 [test_index] 中总字段 [1000] 的限制
我想了解此异常的确切原因,因为我定义映射的字段和字段的数量都小于 1000。
注意:我有嵌套字段和启用动态映射。
问候,
桑迪普
我们将弹性搜索用于以下用例.
Elasticsearch版本:5.1.1
注意:我们使用的是AWS托管的ElasticSearch
我们有一个多租户系统,在每个租户中存储多个事物的数据,租户数量将逐日增加.
exa:每个租户都有以下信息.
1] tickets
2] sw_inventory
3] hw_inventory
Run Code Online (Sandbox Code Playgroud)
目前的索引策略如下:
indexname:
tenant_id(GUID)exa:tenant_xx1234xx-5b6x-4982-889a-667a758499c8
类型:
1] tickets
2] sw_inventory
3] hw_inventory
Run Code Online (Sandbox Code Playgroud)
我们面临的问题:
1]公共字段映射的冲突exa:(id,name,userId)类型(ticket,sw_inventory,hw_inventory)
2]随着租户数量的增加,索引的数量也可以达到1000或2000.
如果我们改变索引策略是不是一个好主意?
exa:索引名称:
1] tickets
2] sw_inventory
3] hw_inventory
Run Code Online (Sandbox Code Playgroud)
类型:
tenant_tenant_id1
tenant_tenant_id2
tenant_tenant_id3
tenant_tenant_id4
Run Code Online (Sandbox Code Playgroud)
所以只有3个巨大的指数,N个类型作为租户.
那么在这种情况下的问题是哪种解决方案更好?
1]许多小指数和3种类型
OR
2] 3个巨大的指数和许多类型
问候
我正在使用 Elasticsearch 5.1.1 并使用 ES 提供的默认映射创建了 500 多个索引。
现在我们决定使用动态模板。为了将此模板/映射应用于旧索引,我需要重新索引所有索引。
最好的方法是什么?我们可以为此使用 Kibana 吗?找不到足够的文档来执行此操作。
我们一直使用此链接作为参考,以适应索引中字段映射的任何更改,并且停机时间为零。
问题:考虑上面链接中的相同示例,当我们使用_reindex API将数据从 my_index_v1 重新索引到 my_index_v2 时。ElasticSearch 是否保证在 my_index_v1 中发生的任何并发更新肯定会使其成为 my_index_v2 ?
例如,文档可能会在 my_index_v1 中被 api 重新索引到 my_index_v2 之前或之后更新。
最终,我们只需要确保虽然我们不希望任何映射更改造成任何停机时间(因此 _reindex 使用别名和 ES 的其他很酷的东西),我们还希望确保在此期间没有丢失任何添加/更新大规模的重新索引正在进行中,因为我们正在讨论重新索引 > 50GB 的数据。
谢谢,
桑迪普
我们正在尝试使用以下无痛脚本来重新索引 Elasticsearch 中的数据。
POST _reindex
{
"source": {
"index": "metricbeat-*"
},
"dest": {
"index": "metricbeat"
},
"script": {
"lang": "painless",
"inline": "ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'"
}
}
Run Code Online (Sandbox Code Playgroud)
该脚本运行完美,并创建了我们所有索引的另一个副本。exa:如果我在运行此脚本后将原始索引设置为 metricbeat-2016.05.30,它将创建 metricbeat-2016.05.30-1,它是原始索引的精确副本,即 (metricbeat-2016.05.30)
现在我想做以下两件事:
1] 删除原始索引,即 metricbeat-2016.05.30
2] 将重新索引的索引或原始索引的副本(即(metricbeat-2016.05.30-1))重命名为 metricbeat-2016.05.30,即原始索引。
我们应该怎么做 ?我们可以修改上面的无痛脚本吗?
提前致谢 !
我们有一个要求,我们需要跨多个索引进行查询,如下所示
我们正在使用 ElasticSearch 5.1.1。
http://localhost:9200/index1,index2,index3/type1,type2/_search
查询:
{
"query": {
"multi_match": {
"query": "data",
"fields": ["status"]
}
}
}
Run Code Online (Sandbox Code Playgroud)
然而,我们可能事先不知道索引是否存在,如果上述索引不存在,我们会得到以下错误。
{
"error": {
"root_cause": [
{
"type": "index_not_found_exception",
"reason": "no such index",
"resource.type": "index_or_alias",
"resource.id": "index3",
"index_uuid": "_na_",
"index": "index3"
}
],
"type": "index_not_found_exception",
"reason": "no such index",
"resource.type": "index_or_alias",
"resource.id": "index3",
"index_uuid": "_na_",
"index": "index3"
},
"status": 404
}
Run Code Online (Sandbox Code Playgroud)
一种明显的方法是检查索引是否已经存在,但我想避免额外的调用。
注意:至少有 1 个索引始终存在
是否可以避免此异常?
提前致谢 !!
我正在关注版本6.0的elasticsearch指南:https: //www.elastic.co/guide/en/elasticsearch/reference/master/removal-of-types.html
1]创建映射
PUT/twitter
{
"mappings": {
" **_doc** ": {
"properties": {
"type": { "type": "keyword" },
"name": { "type": "text" },
"user_name": { "type": "keyword" },
"email": { "type": "keyword" },
"content": { "type": "text" },
"tweeted_at": { "type": "date" }
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
2]创建文档.
PUT twitter/_doc/user-kimchy
{
"type": "user",
"name": "Shay Banon",
"user_name": "kimchy",
"email": "shay@kimchy.com"
}
Run Code Online (Sandbox Code Playgroud)
什么是1和2中的"_doc"?考虑到类型远离Elasticsearch 6.0.0的事实
提前致谢 !!
我有一个这样的有效载荷,相同的有效载荷将出现在所有文档中,但每个文档中每个标签的权重都不同。
{
"tags": [
{
"tag": "tag1",
"weight": 5
},
{
"tag": "tag2",
"weight": 10
},
{
"tag": "tag3",
"weight": 7
}
]
}
Run Code Online (Sandbox Code Playgroud)
我在映射中使用了嵌套字段,因为我想匹配数组元素而不是整个数组。
{
"mappings": {
"doc": {
"properties": {
"tags": {
"type": "nested",
"properties": {
"tag": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"weight": {
"type": "double"
}
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的要求是搜索标签并根据文档中的权重对该特定标签进行排序。我试过下面的查询,但它没有按预期排序。
{
"from": 0,
"size": 50,
"sort": [
{
"tags.weight": {
"order": "asc",
"nested_filter": {
"term": …Run Code Online (Sandbox Code Playgroud)