Home > Back-end >  Failed to find analyzer Elasticsearch
Failed to find analyzer Elasticsearch

Time:09-29

I have this indice :

    {
        "movies": {
            "aliases": {},
            "mappings": {},
            "settings": {
                "index": {
                    "routing": {
                        "allocation": {
                            "include": {
                                "_tier_preference": "data_content"
                            }
                        }
                    },
                    "number_of_shards": "1",
                    "provided_name": "movies",
                    "creation_date": "1632841492405",
                    "analysis": {
                        "filter": {
                            "autcomplete_filter": {
                                "type": "edge_ngram",
                                "min_gram": "1",
                                "max_gram": "20"
                            }
                        },
                        "analyser": {
                            "autocomplete": {
                                "filter": [
                                    "lowercase",
                                    "autocomplete_filter"
                                ],
                                "type": "custom",
                                "tokenizer": "standard"
                            }
                        }
                    },
                    "number_of_replicas": "1",
                    "uuid": "IhEcIyw1QoKRDVS8Drfj1w",
                    "version": {
                        "created": "7140199"
                    }
                }
            }
        }
    }

And when I want to test my analyzer with this :

curl -XGET "127.0.0.1:9200/movies/_analyze?pretty" -H "Content-Type: application/json" -d '
{
    "analyzer": "autocomplete",
    "text": "Sta"
}'

I have this error.

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "failed to find analyzer [autocomplete]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "failed to find analyzer [autocomplete]"
  },
  "status" : 400
}

I don't understand why because we can see that the autocomplete analyzer exist. If I try to create the analyzer again , ES says that it already exist.

Could you help me to solved my probleme please.

CodePudding user response:

Change this:

   "analyser":{
      ...
      }
   }

To:

   "analyzer":{
     ...
      }
   }
  • Related