Add a more descriptive example to Index Template

Closes #17513
The current example in the documentation for Index Templates lacks any properties values. This is helpful to many devs that aren't sure how to take a regular Index Mapping and convert it to a template.
This commit is contained in:
Mahmoud Lababidi 2016-04-04 13:29:07 -04:00 committed by Clinton Gormley
parent c5bbb023fa
commit 20b398daea
1 changed files with 21 additions and 10 deletions

View File

@ -4,7 +4,7 @@
Index templates allow you to define templates that will automatically be
applied when new indices are created. The templates include both settings and
mappings, and a simple pattern template that controls whether the template
should be applied to the new index.
should be applied to the new index.
NOTE: Templates are only applied at index creation time. Changing a template
will have no impact on existing indices.
@ -13,20 +13,31 @@ For example:
[source,js]
--------------------------------------------------
curl -XPUT localhost:9200/_template/template_1 -d '
PUT /_template/template_1
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
"template": "te*",
"settings": {
"number_of_shards": 1
},
"mappings": {
"type1": {
"_source": {
"enabled": false
},
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z YYYY"
}
}
}
}
}
'
--------------------------------------------------
// AUTOSENSE
Defines a template named template_1, with a template pattern of `te*`.
The settings and mappings will be applied to any index name that matches