Can not add mapping

I'm using Elasticsearch 5.6 (I know it's outdated but I can not switch it right now).

I'm doing the following request:

    {
       "settings":{
          "index":{
             "analysis":{
                "filter":{
                   "autocomplete_filter":{
                      "type":"ngram",
                      "min_gram":2,
                      "max_gram":14
                   }
                },
                "char_filter":{
                   "parentheses_filter":{
                      "type":"mapping",
                      "mappings":{
                         "(":"_",
                         ")":"_"
                      }
                   }
                },
                "analyzer":{
                   "autocomplete":{
                      "type":"custom",
                      "tokenizer":"standard",
                      "filter":[
                         "lowercase",
                         "asciifolding",
                         "parentheses_filter",
                         "autocomplete_filter"
                      ]
                   }
                }
             }
          }
       },
       "mappings":{
          "default":{
             "properties":{
                    ...
             }
          }
       }
    }

And getting the following error:

    {
       "error":{
          "root_cause":[
             {
                "type":"illegal_argument_exception",
                "reason":"mapping requires either `mappings` or `mappings_path` to be configured"
             }
          ],
          "type":"illegal_argument_exception",
          "reason":"mapping requires either `mappings` or `mappings_path` to be configured"
       },
       "status":400
    }

If my eyes don't lie me I provided the mappings property of the custom mapping filter but ES can't recognize it and asks me to provide it. What I'm doing wrong?

Ah, my bad, mappings should be an array, not an object.

1 Like

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