elasticsearch Elasticsearch为多个索引中的所有字段设置“ignore_over”,elasticsearch,indexing,mapping,elasticsearch,Indexing,Mapping" /> elasticsearch Elasticsearch为多个索引中的所有字段设置“ignore_over”,elasticsearch,indexing,mapping,elasticsearch,Indexing,Mapping" />

elasticsearch Elasticsearch为多个索引中的所有字段设置“ignore_over”

elasticsearch Elasticsearch为多个索引中的所有字段设置“ignore_over”,elasticsearch,indexing,mapping,elasticsearch,Indexing,Mapping,我使用200+索引进行弹性搜索。文档有时包含很长的文本字段,这些字段是无用的,并且需要太多的索引功能 我需要为所有索引中的所有字段自动设置限制。 我正试着用它 我找到了一些示例,可以通过名称为特定字段设置它。 如何将其应用于所有(当前和未来)索引和字段? 如何将其应用于所有(当前和未来)索引和字段 模板中的设置仅适用于新索引。对于现有索引,您需要更新单个索引的映射 在所有索引中应用此设置的方式因Elasticsearch版本而异。我可以向您展示我尝试过的两个版本,并且知道它是有效的 ES 2.4

我使用
200+
索引进行弹性搜索。文档有时包含很长的文本字段,这些字段是无用的,并且需要太多的索引功能

我需要为所有索引中的所有字段自动设置限制。 我正试着用它

我找到了一些示例,可以通过名称为特定字段设置它。
如何将其应用于所有(当前和未来)索引和字段?

如何将其应用于所有(当前和未来)索引和字段

模板中的设置仅适用于新索引。对于现有索引,您需要更新单个索引的
映射

在所有索引中应用此设置的方式因Elasticsearch版本而异。我可以向您展示我尝试过的两个版本,并且知道它是有效的

ES 2.4

    "mappings": {
    "_default_": {
        "dynamic_templates": [
            {
                "string_fields": {
                    "mapping": {
                        "ignore_above": 10922,
                        "index": "not_analyzed",
                        "type": "string"
                    },
                    "match_mapping_type": "string",
                    "match": "*"
                }
            }
        ]
        },
        "<your object type>": {
    <other settings>
    }
}
“映射”:{
“\u默认值”:{
“动态模板”:[
{
“字符串字段”:{
“映射”:{
“忽略上面的内容”:10922,
“索引”:“未分析”,
“类型”:“字符串”
},
“匹配映射类型”:“字符串”,
“匹配”:“*”
}
}
]
},
"": {
}
}
ES 6.1

"mappings": {
    "_default_" : {
        "dynamic_templates" : [
            {
                "string_fields" : {
                    "mapping" : {
                        "type" : "keyword",
                        "ignore_above" : 8191,
                        "index": true
                },
                "match_mapping_type" : "string",
                "match" : "*"
                }
            }
        ]
    }, 
    "<your object type>": {
    <other settings>
    }
}
“映射”:{
“\u默认值”:{
“动态模板”:[
{
“字符串字段”:{
“映射”:{
“类型”:“关键字”,
“忽略上面的内容”:8191,
“索引”:正确
},
“匹配映射类型”:“字符串”,
“匹配”:“*”
}
}
]
}, 
"": {
}
}
\u default\u下的
映射
将适用于所有对象类型,并且可以使用
下的设置进行覆盖

如何将其应用于所有(当前和未来)索引和字段

模板中的设置仅适用于新索引。对于现有索引,您需要更新单个索引的
映射

在所有索引中应用此设置的方式因Elasticsearch版本而异。我可以向您展示我尝试过的两个版本,并且知道它是有效的

ES 2.4

    "mappings": {
    "_default_": {
        "dynamic_templates": [
            {
                "string_fields": {
                    "mapping": {
                        "ignore_above": 10922,
                        "index": "not_analyzed",
                        "type": "string"
                    },
                    "match_mapping_type": "string",
                    "match": "*"
                }
            }
        ]
        },
        "<your object type>": {
    <other settings>
    }
}
“映射”:{
“\u默认值”:{
“动态模板”:[
{
“字符串字段”:{
“映射”:{
“忽略上面的内容”:10922,
“索引”:“未分析”,
“类型”:“字符串”
},
“匹配映射类型”:“字符串”,
“匹配”:“*”
}
}
]
},
"": {
}
}
ES 6.1

"mappings": {
    "_default_" : {
        "dynamic_templates" : [
            {
                "string_fields" : {
                    "mapping" : {
                        "type" : "keyword",
                        "ignore_above" : 8191,
                        "index": true
                },
                "match_mapping_type" : "string",
                "match" : "*"
                }
            }
        ]
    }, 
    "<your object type>": {
    <other settings>
    }
}
“映射”:{
“\u默认值”:{
“动态模板”:[
{
“字符串字段”:{
“映射”:{
“类型”:“关键字”,
“忽略上面的内容”:8191,
“索引”:正确
},
“匹配映射类型”:“字符串”,
“匹配”:“*”
}
}
]
}, 
"": {
}
}
\u default\u下的
映射
将适用于所有对象类型,并且可以使用
下的设置进行覆盖