I can't edit mapping

I want to create an index with an ngram analyzer. This is what I do
PUT /my_index/
{
"settings": {
"analysis": {"filter": {
"trigrams_filter": {
"type": "ngram",
"min_gram": 3,
"max_gram": 3,
"token_chars": [
"letter",
"digit"
]
}
},
"analyzer": {
"trigrams": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"trigrams_filter"
]
}
}
}
}
}

Now I want to edit the mapping like this
PUT /my_index/_mapping/_all
{

    "title": {
      "properties": {
        "title": {
          "type": "text",
          "fields": {
            
            "general": { 
              "type":     "text",
              "analyzer": "trigrams"
            }
          }
        }
      }
    }
  }

what leads to this error message
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [title : {properties={title={type=text, fields={general={type=text, analyzer=trigrams}}}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [title : {properties={title={type=text, fields={general={type=text, analyzer=trigrams}}}}}]"
},
"status": 400
}

I have no idea what I am doing wrong please help me

I don't think the _all in your update request URL should be there. Instead of _all you should provide the document type. And when you do so, there's no need to provide the document type as part of the body. If your document type is title, the second request should be:

PUT /my_index/_mapping/title
{
  "properties": {
    "title": {
      "type": "text",
      "fields": {
        "general": {
          "type": "text",
          "analyzer": "trigrams"
        }
      }
    }
  }
}

By the way, please format the code snippets that you post on this forum using the </> button, so those get formatted correctly.

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