Reputation: 1377
I have studied Indices-templates on elastic search website and I understood it. Now My requirement is that I want to apply same template on two indices. Suppose I have a template file : template_search.json and I want this template to be applied on two indices - index1_, index2_ So In this file, I have defined the template attribute in this template file as below:
"template" : "index1_*,index2_*"
But I am giving following validation error:
Error uploading template: {"root_cause":[{"type":"invalid_index_template_exception","reason":"index_template [template_search] invalid, cause [Validation Failed: 1: template must not contain a ',';2: template must not container the following characters [\\, /, *, ?, \", <, >, |, , ,];]"}],"type":"invalid_index_template_exception","reason":"index_template [template_search] invalid, cause [Validation Failed: 1: template must not contain a ',';2: template must not container the following characters [\\, /, *, ?, \", <, >, |, , ,];]"}
I know one way of doing this, I can create one separate file for each index. But then I will have the two different files with same data.
I have tried to search it on StackOverflow but didn't find any answer which can help me in solving it. Can somebody know how to define multiple indices in a single template file ? Thanks in advance.
Upvotes: 0
Views: 2063
Reputation: 1804
The next major version of Elasticsearch (6.x) will support index_patterns
as an array to fill this gap, see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
For 5.x you are stuck with creating more than one template for now (or use index*
).
Upvotes: 0