我在弹性搜索网站上研究了Indices-templates,我明白了 . 现在我的要求是我想在两个索引上应用相同的模板 . 假设我有一个模板文件:template_search.json,我希望这个模板应用于两个索引 - index1_,index2_所以在这个文件中,我已经在这个模板文件中定义了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上搜索它,但没有找到任何可以帮助我解决它的答案 . 有人可以知道如何在单个模板文件中定义多个索引吗?提前致谢 .
1 回答
Elasticsearch(6.x)的下一个主要版本将支持
index_patterns
作为填补这一空白的数组,请参阅https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html对于5.x,您现在无法创建多个模板(或使用
index*
) .