ElasticSearch Index templates属性描述

来源:互联网 发布:ps淘宝图标教程视频 编辑:程序博客网 时间:2024/05/16 02:08
<pre name="code" class="javascript">PUT /_template/template_1{  "template": "te*", //这个属性指明模版将应用于所有符合te*命名规则的索引  "settings": {    "number_of_shards": 1  },  "mappings": {    "type1": {      "_source": {        "enabled": false      },      "properties": {        "host_name": {          "type": "string",          "index": "not_analyzed"        },        "created_at": {          "type": "date",          "format": "EEE MMM dd HH:mm:ss Z YYYY"        }      }    }  }}curl -XPUT localhost:9200/_template/template_1 -d ' //第一个模版{    "template" : "*",    "order" : 0,//该属性用于模版属性合并    "settings" : {        "number_of_shards" : 1    },    "mappings" : {        "type1" : {            "_source" : { "enabled" : false }        }    }}'curl -XPUT localhost:9200/_template/template_2 -d ' //第二个模版{    "template" : "te*",    "order" : 1,//该属性用于模版属性合并    "settings" : {        "number_of_shards" : 1    },    "mappings" : {        "type1" : {            "_source" : { "enabled" : true }        }    }}'第一个模版和第二个模版都可以应用于te*命名规则的索引,在这种情况下,两个模版的属性会进行合并,然后应用于索引,合并的规则是order属性值大的模版覆盖order属性值小的模版。
参考文献

                                             
0 0
原创粉丝点击