S
S
starosta462019-11-06 14:42:55
elasticsearch
starosta46, 2019-11-06 14:42:55

How to fix wrong data type in Elasticsearch document?

An index was created in elasticksearch, the mapping was not created, as it can be created automatically when the document is first inserted. New documents are added via an api where the data types are clearly defined in the data structures. But in some elasticsearch documents, some fields have become a different data type (string instead of int). Could this be an elasticsearch bug or is it necessary to look for a bug in the api? How can I automatically overwrite only the wrong data with the correct type?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2019-11-06
@inoise

This is due to the lack of initial mapping. Elastic in this regard is very stupid, and if the rules of the game are not immediately explained to him, then he does not agree to new ones. There are 2 options:
- kill the index, recreate it with the correct mapping, reload the data
- create an index next to it with the correct mapping, copy the data there, delete the old index and create an alias

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question