Field Collapsing

Mapping:

PUT /my_index/_mapping/blogpost
{
  "properties": {
    "user": {
      "properties": {
        "name": { 
          "type": "string",
          "fields": {
            "raw": { 
              "type":  "string",
              "index": "not_analyzed"
            }
          }
        }
      }
    }
  }
}

Error:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "mapper [user] of different type, current_type [long], merged_type [ObjectMapper]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "mapper [user] of different type, current_type [long], merged_type [ObjectMapper]"
  },
  "status": 400
}

Data to be ingested:

PUT /my_index/blogpost/2
{
  "title": "Relationships",
  "body": "It's complicated...",
  "user": {
    "id": 1,
    "name": "John Smith"
  }
}

How should I resolve this mapping Issue?

It seems you have indexed the user field as a long somewhere. you need to reindex your data to fix it. Take a look at the reindex API how to index your data into another index, where you can fix the mapping beforehand.

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