1
votes

I am new to elastic search, I want to updated the existing mapping under my index. My existing mapping looks like

"load":{
    "mappings": {
        "load": {
            "properties":{
                "customerReferenceNumbers": {
                   "type": "string",
                   "index": "no"
                }
             }
         }
     } 
 }

I would like to update this field from my mapping to be analyzed, so that my 'customerReferenceNumber' field will be available for search. I am trying to run the following query in Sense plugin to do so,

PUT /load/load/_mapping { "load": {
    "properties": {    
        "customerReferenceNumbers": {
            "type": "string",
            "index": "analyzed"
           }
    }
}}

but I am getting following error with this command, MergeMappingException[Merge failed with failures {[mapper customerReferenceNumbers] has different index values]

Though there exist data associated with these mappings, here I am unable to understand why elastic search not allowing me to update mapping from no-index to indexed?

Thanks in advance!!

2

2 Answers

2
votes

ElasticSearch doesn't allow this kind of change.

And even if it was possible, as you will have to reindex your data for your new mapping to be used, it is faster for you to create a new index with the new mapping, and reindex your data into it.

If you can't afford any downtime, take a look at the alias feature which is designed for these use cases.

1
votes