Dynamic mapping for index


(golchhamohit) #1

Hi all,

      I am new to Elastic Search and I had a use case which needs to 

create a mapping dynamically on addition of an index.
I heard about dynamic templates and read some about it, all examples given
are regarding mapping dynamically added fields.
Is the same possible for index ?. Also, the index for which I want to
dynamically create mapping is of two digit and the type
is also of two digit. Is it possible to restrict the templates only to
those specifications. Can you provide with a simple example
of how to create a template with any simple mapping that applies to all
indices and types with 2 digits ?

Thanks & Regards,
Mohit Golchha

--
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/c4563bd0-6bc8-4178-9a69-ad4e62ca3bf3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly) #2

Yes, you can read more about index templates here:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html

You can use a name pattern to match what indexes to apply the template to.
You can also define dynamic templates:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-root-object-type.html#_dynamic_templates

To match field names, or types. I don't think you can do something like
match only if the value is 2 digits.

--
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/e099f321-fd02-4509-9375-6aa2a378e23a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3