Vikas Gupta
Vikas Gupta

Reputation: 10904

Elastic Search : Update mapping of one field in existing index

I have an index with the following mapping:

{
          "code_sourcenodedupefilecontractv4_1421_shared_5dd3788f-2d0a-4a49-b679-98bbf519013e": {
            "mappings": {
              "SourceNoDedupeFileContractV4": {
                "_meta": {
                  "version": 1421
                },
                "_routing": {
                  "required": true
                },
                "properties": {

                  .
                  .
                  .
                  .

                  "indexedTimeStamp": {
                    "type": "date",
                    "store": true,
                    "doc_values": false,
                    "format": "epoch_second"
                  },
                  .
                  .
                  .
                  .
                  .

                }
              }
            }
          }
        }

I have to change the field doc_value to true. I have tried with the following but getting exception while trying.

PUT code_sourcenodedupefilecontractv4_1421_shared_5dd3788f-2d0a-4a49-b679-98bbf519013e/_mapping/SourceNoDedupeFileContractV4
{
  "properties": {
    "indexedTimeStamp": {
      "type": "date",
      "doc_values" : true
    }
  }
}

And the exception I am getting is while trying the command:

    {
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Mapper for [indexedTimeStamp] conflicts with existing mapping in other types:\n[mapper [indexedTimeStamp] has different [store] values, mapper [indexedTimeStamp] has different [doc_values] values, mapper [indexedTimeStamp] has different [format] values]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Mapper for [indexedTimeStamp] conflicts with existing mapping in other types:\n[mapper [indexedTimeStamp] has different [store] values, mapper [indexedTimeStamp] has different [doc_values] values, mapper [indexedTimeStamp] has different [format] values]"
  },
  "status": 400
}

Any idea what I am doing wrong here? Any help would be really appreciated.

Upvotes: 0

Views: 4084

Answers (1)

Assael Azran
Assael Azran

Reputation: 2993

doc_values can not be updated.

You will have to delete your index update your mapping and reindexing your data.

See my answer about reindexing

Upvotes: 1

Related Questions