我在ElasticSearch网站上学习了Indices-templates,我理解了它。现在我的要求是,我想在两个索引上应用相同的模板。假设我有一个模板文件:template_search.json,我想在两个索引上应用这个模板-index 1_,index 2_ 所以在这个文件中,我定义了这个模板文件中的template属性如下:
"template" : "index1_*,index2_*"
字符串
但我给出了以下验证错误:
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 [\\, /, *, ?, \", <, >, |, , ,];]"}
型
我知道一种方法,我可以为每个索引创建一个单独的文件,但这样我就有了两个不同的文件和相同的数据。
我试着在StackOverflow上搜索它,但没有找到任何可以帮助我解决它的答案。有人知道如何在一个模板文件中定义多个索引吗?提前感谢。
2条答案
按热度按时间i5desfxk1#
Elasticsearch的下一个主要版本(6.x)将支持
index_patterns
作为数组来填补这一空白,参见https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html对于5.x,你现在只能创建多个模板(或者使用
index*
)。iqjalb3h2#
Reference Link
字符串