此限制已在以下 GitHub issue 中引入。
命令计数grep type | wc -l 计算带有文本"type" 的行数。因此,我想计数可能不准确。我做了一个小文本,我得到了比实际字段数更高的值。所以你得到的字段数也可能少于实际数量,但我还想不出一个场景。
这是我做的测试。
curl -s -XGET http://localhost:9200/stackoverflow/_mapping?pretty
{
"stackoverflow" : {
"mappings" : {
"os" : {
"properties" : {
"NAME" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"TITLE" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
},
"fielddata" : true
},
"title" : {
"type" : "text",
"fielddata" : true
}
}
}
}
}
}
由于 "type" 存在 5 行,即使我只有 3 个字段,我也会得到输出为 5。
您能否尝试增加限制,看看是否有效?
PUT my_index/_settings
{
"index.mapping.total_fields.limit": 2000
}
您还可以在创建索引期间增加此限制。
PUT my_index
{
"settings": {
"index.mapping.total_fields.limit": 2000,
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
...
}
}
致谢:https://discuss.elastic.co/t/total-fields-limit-setting/53004/2