我正在创建一个像这样的动态索引映射模板。
PUT my-index-000001
{
"mappings": {
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword",
"ignore_above": 256
}
}
}
]
}
}
我想添加一个渗透器字段作为此模板的一部分,如下所示(它不起作用):
{
"mappings": {
"query": {
"type": "percolator"
},
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword",
"ignore_above": 256
}
}
}
]
}
}
如何创建具有渗滤器支持的动态映射模板?
到目前为止,干得好!你就快到了,你只需要这样做:
{
"mappings": {
"properties": { <----- add this section
"query": {
"type": "percolator"
}
},
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword",
"ignore_above": 256
}
}
}
]
}
}