How to update elasticsearch field type How to update elasticsearch field type elasticsearch elasticsearch

How to update elasticsearch field type


It is not possible to change the data type if you have data present.

You'll have to delete your index, create the mapping with the data type you want, and re-index your data.


To re-index you will need to export and re-import your data - there are some tools (scan&scroll and bulk API) to make this easier, see reindexing your data.

An alternative is to create a new index and then use aliasing - i.e. when doing an insert write to the latest index (could use an alias with a single index in it), but when doing a query, read from an alias that includes all relevant indexes (new and old versions of the index).