Elasticsearch update index template
Asked Answered
T

2

7

I have a question about elasticsearch index template, there is a scene of my question.

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. After a period of time, I need create some new fields in indice, and I update the templateA.

SO, How to make the previously created indices use the new template? please give me some suggestion. Thanks a lot!

Tavey answered 7/7, 2016 at 6:8 Comment(0)
B
8

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.

Baalbeer answered 7/7, 2016 at 9:3 Comment(2)
This answer is not very match my problem, but I didn't find a better answer! Thanks for the same.Tavey
Just to clarify - even the template used to create the index can be updated, but you need to use the PUT mapping API (which is index related) instead of PUT index template API.Badalona
A
0

At least in ElasticSearch 7.15 you could create or update an index template using the same endpoint, also:

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.

Atlante answered 2/11, 2021 at 17:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.