Index template

What is the importance of Index template?
Could someone explain with an example?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b2d425bf-8204-4fa3-ad02-2a9202fb2d16%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

If you find yourself repeatedly creating indexes with some similar
characteristics, then you create an index template. Whenever you create a
new index and if a template exists that matches it, then the template will
be applied along with whatever you have predefined inside the template. An
example is below (taken directly from the docs -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html#multiple-templates):

curl -XPUT localhost:9200/_template/template_1 -d '
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
'

The above template says, if anybody creates a new index in the future with
a name that starts with te ("te*"), then automatically make 1 shard for it,
and disable the _source field.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/498f5a74-4b0f-44a3-b88c-87f2a2b8b07f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

If you find yourself repeatedly creating indexes with some similar
characteristics, then you create an index template. Whenever you create a
new index and if a template exists that matches it, then the template will
be applied along with whatever you have predefined inside the template. An
example is below (taken directly from the docs -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html#multiple-templates
):

curl -XPUT localhost:9200/_template/template_1 -d '
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
'

The above template says, if anybody creates a new index in the future with
a name that starts with te ("te*"), then automatically make 1 shard for it,
create a type named type1, and disable its _source field.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/68d649d7-3df4-48a7-8832-9a42243637cb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

If you find yourself repeatedly creating indexes with some similar
characteristics, then you create an index template. Whenever you create a
new index and if a template exists that matches it, then the template will
be applied along with whatever you have predefined inside the template. An
example is below (taken directly from the docs -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html):

curl -XPUT localhost:9200/_template/template_1 -d '
{
"template" : "te*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"type1" : {
"_source" : { "enabled" : false }
}
}
}
'

The above template says, if anybody creates a new index in the future with
a name that starts with te ("te*"), then automatically make 1 shard for it,
create a type named type1, and disable its _source field.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/23313c6a-ac12-49a1-aa57-23e6be854ee1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you for your response.

My requirement is to create index based on some of the fields of the Actual
Message using the template.

For example,

The content of the actual message be "Place=Austin, Time=Day". Then using
the template i would like to create INDEX based on Place and Time.

Is this possible? If it is, how?

On Saturday, February 15, 2014 1:06:32 AM UTC+5:30, san wrote:

What is the importance of Index template?
Could someone explain with an example?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1d0392f7-e00f-4eb2-b787-31d0ed3d9f9b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No, I do not believe you can make a template based on values in your data.
However, you can always parse your document first, and then decide what to
name your index, and then have index template match on the name that you
use.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f8bbe52c-15a2-46da-94da-6327e636ebd5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.