Convert string to int by reindexing

I have quite a few indexes matching the pattern logstash-*

In them I have a keyword called 'bytes_read'.

It's type according to elasticsearch is string. This is due to an issue with our logstash configuration. I have corrected this configuration.

  1. Is it possible to add a field to all existing index called _bytes_read that's in integer form?
  2. Is this achievable via the reindexing API?
  3. Is there a better way?

You can certainly add a new field to the existing mapping. For it to be populated with an int version of your keyword, you'll then need to run an Update-by-Query to pick up the new property.

You could also change the mapping of the existing field via reindexing and aliasing the index.

1 Like

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