Elasticsearch Percolator 索引 + 动态索引模板

问题描述 投票:0回答:1

我正在创建一个像这样的动态索引映射模板。

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
          }
        }
      }
    ]
  }
}

如何创建具有渗滤器支持的动态映射模板?

elasticsearch
1个回答
0
投票

到目前为止,干得好!你就快到了,你只需要这样做:

{
  "mappings": {
    "properties": {                  <----- add this section
      "query": {
        "type": "percolator"
      }
    },
    "dynamic_templates": [
      {
        "strings": {
          "match_mapping_type": "string",
          "mapping": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }
    ]
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.