ElasticSearch a filed put to index doesnt show in the index

I am using the following code to insert new field to existing index. I don't want to reset the indexed data, just to add new field to existing index and old records in index should have null in field colour:

curl -XPUT 'http://10.10.10.10:9200/myevents/_mapping/event' -d '{ "event" : { "properties" : { "colour":{ "search_analyzer": "search_ngram", "analyzer": "index_ngram", "type": "text" } } }}'

{"acknowledged":true}

Type event has new field colour but indexed elements doesnt.. Do I have to refresh the index somehow?

A change of the mapping will only affect new documents, if you want the old documents in the index to get the new / changed fields you will have to reindex them.

1 Like

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