Add field by reindexing

How do I add a field to my index? I wanted a day of week field for my dashboard in Kibana. I was able to add it in Logstash, but need to reindex to add it to past documents? I've read over the documentation but it doesn't have enough details or examples for someone just learning elastic search.

You should be able to use the reindex API together with a painless script. An example featuring a painless script similar to what you may be looking for is available in this blog post.

1 Like

I’m very new to Elasticsearch and need some more examples on how to use it, can you help?

bump

bump

What have you tried so far?

Not even sure how to start.

The example just before this section of the documentation, shows how you can use the reindex API together with an ingest pipeline.

This section goes through how you create and store an ingest pipeline that you can use from your reindex API. In this pipeline you will want to use a script processor to calculate the new fields.

In order to create the painless script, you can look at the date math example in this blog post for inspiration.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.