简体   繁体   English

Elasticsearch 更新索引模板

[英]Elasticsearch update index template

I have a question about elasticsearch index template, there is a scene of my question.我有一个关于elasticsearch索引模板的问题,我的问题有一个场景。

Create a template for a series indices, named templateA , and there are some indices create from this template, named Index-yyyy.mm.dd2 and Index-yyyy.mm.dd2 .为一系列索引创建一个模板,命名为templateA ,并且从这个模板创建了一些索引,命名为Index-yyyy.mm.dd2Index-yyyy.mm.dd2 After a period of time, I need create some new fields in indice, and I update the templateA .一段时间后,我需要在索引中创建一些新字段,并更新templateA

SO, How to make the previously created indices use the new template? SO,如何使之前创建的索引使用新模板? please give me some suggestion.请给我一些建议。 Thanks a lot!非常感谢!

The template is only used at index creation. 该模板仅用于创建索引。 You'll have to modify your mapping or recreate your index and reindex your data. 您必须修改映射或重新创建索引并重新索引数据。

You can use the PUT mapping API to modify your mapping. 您可以使用PUT映射API来修改映射。

At least in ElasticSearch 7.15 you could create or update an index template using the same endpoint, also:至少在 ElasticSearch 7.15 中,您可以使用相同的端点创建或更新索引模板,还可以:

Index templates are applied during data stream or index creation在数据流或索引创建期间应用索引模板

It is ovious but "old" data needs to be updated in some way.这是显而易见的,但“旧”数据需要以某种方式更新。

In case you are using Logstash, just restart it to do the reindex.如果您使用的是 Logstash,只需重新启动它即可进行重新索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM