1
{
  "someindex": {
    "aliases": {
      "somealias": {}
    },
    "mappings": {},
    "settings": {
      "index": {
        "number_of_shards": "5",
        "provided_name": "someindex",
        "creation_date": "1547325991414",
        "analysis": {
          "filter": {
            "autocomplete_filter": {
              "type": "edge_ngram",
              "min_gram": "1",
              "max_gram": "20"
            }
          },
          "normalizer": {
            "lowerCaseNormalizer": {
              "filter": [
                "lowercase"
              ],
              "type": "custom"
            }
          },
          "analyzer": {
            "standard": {
              "filter": [
                "lowercase",
                "autocomplete_filter"
              ],
              "type": "custom",
              "tokenizer": "standard"
            }
          }
        },
        "number_of_replicas": "1",
        "uuid": "9vrt0U90RWG-4MRQEIbj6w",
        "version": {
          "created": "6050499"
        }
      }
    }
  }
}

Above is the structure of my newly created structure. In my current setup, I have an attribute named bookName on my current index for which current mapping is done as below:

{
  "bookName": {
    "type": "text",
    "fields": {
      "keyword": {
        "type": "keyword",
        "ignore_above": 256,
        "normalizer": "lowerCaseNormalizer"
      }
    }
  }
}

Now when I am trying to re-index my new index named "someindex" and want to insert new mapping for the field bookName then it is giving me error."

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Root mapping definition has unsupported parameters:  [mappings : {details={properties={suggest={type=completion}, bookName={type=text, analyzer=standard}}}}]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Root mapping definition has unsupported parameters:  [mappings : {details={properties={suggest={type=completion}, bookName={type=text, analyzer=standard}}}}]"
  },
  "status": 400
}

I have tried everything and i am able to do it from scratch on random data for testing. But, I have to introduce this feature in my project and i have one elastic index ready with different mappings. Migration is troubling me a lot. Can someone guide me to a proper procedure on how to achieve this.

Note : I have tried everything, searched Elastic docs and all relevant links. I am able to do it on new data set but migration is the real problem for me as i am new to this field.

Nishant
  • 7,504
  • 1
  • 21
  • 34
jatin mahajan
  • 81
  • 2
  • 7

1 Answers1

0

To update the mapping of index you have to use put mapping api. So to update the mapping use the below request:

PUT someindex/_mappings/_doc
{
  "properties": {
    "bookName": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256,
          "normalizer": "lowerCaseNormalizer"
        }
      }
    }
  }
}

Note that I have assumed that the mapping name is _doc.

Nishant
  • 7,504
  • 1
  • 21
  • 34