弹性搜索动态模板不起作用

Elastic search dynamic template not working

我有弹性搜索堆栈:我有模板

{
 "template": "vivek-*",
"settings": {
  "number_of_shards": 40,
  "index.mapper.dynamic": true
},
"dynamic_templates": [
  {
    "date": {
      "match": "*Utc",         
      "mapping": {
        "type": "date"
      }
    }
  }
],
"mappings": {
  "vivek": {
    "_source": {
      "enabled": true
    },
    "properties": {


    }
  }
}

} 我正在放置以下文件:

{
    "attribute1Utc": 1483999887069
}

Elastic search 仍将其检测为: attribute1Utc 数字

您只是把映射弄错了,dynamic_templates 部分需要进入映射类型,就像这样。之后就可以了。

{
  "template": "vivek-*",
  "settings": {
    "number_of_shards": 40,
    "index.mapper.dynamic": true
  },
  "mappings": {
    "vivek": {
      "_source": {
        "enabled": true
      },
      "dynamic_templates": [
        {
          "date": {
            "match": "*Utc",
            "mapping": {
              "type": "date"
            }
          }
        }
      ],
      "properties": {}
    }
  }
}