Https://www.elastic.co/guide/en/elasticsearch/reference/1.7/indices-templates.html
One
Index templates, define templates, automatically match when new indexes are created, and apply defined templates
New Index Template (Index templates)
We create a new index template template_1 set it to a primary shard of 1. Types are type1 and _source disabled
put /_template/template_1{ "template": "t-*", "Settings": { "Number_of_shards":1 }, "mappings": { "type1": { "_source":{ "enabled": false } } }}post /t-1get /t-1/_ mapping{ "T-1": { "mappings": { "Type1": { "_source": { "Enabled": false }, "Properties": {} } } }}
Example: When we want to create an index again, we create an alias for it
PUT/_template/template_2{"template": "s-*", "settings": {"number_of_shards": 1}, "aliases": {"alias1": { }, "{Index}-alias": {}}}post/s-1get/s-1
When multiple index templates are created and an index is created and matched by multiple index templates, settings and mappings are merged into one configuration and applied to the index, which is controlled by the Order property of the index template. The order of the large will overwrite the previous configuration
put /_template/template_1{ "template": "*", "order":0, "Settings":{ "Number_of_shards":1 }, "Mappings":{ "type1": { "_source":{ "Enabled":false } } }}PUT /_template/template_2{ "template": "tt-*", "Order":1, "Settings":{ " Number_of_shards ":1 }, " mappings ":{ "Type1": { "_source":{ "Enabled":true } } }}POST /tt-1 => will be matched by both of the above templates, and for the _source attribute order=1 will overwrite order=0 that is enabled:true
File configuration: We can add the JSON configuration file in the Config/templates directory again
Elasticsearch "Index templates index Templates"