Search code examples
elasticsearchelasticsearch-pluginelasticsearch-2.0

ElasticSearch failed to find analyzer?


I configured my global custom analyzer in elasticsearch.yml,here is my configuration:

index :
analysis :
    analyzer :
        titleAnalyzer :
            type : custom
            tokenizer : ik_max_word
            filter : [titleSynoymFilter, englishStemmerFilter]
    filter :
        titleSynoymFilter :
            type : synonym
            synonyms_path : ../analysis/title_synonym.txt
        englishStemmerFilter :
            type : stemmer
            name : english

then I test my analyzer by running command $ echo 'A drop in the ocean'| http :5600/_analyze?analyzer=titleAnalyzer

but elasticsearch told me it failed to find the analyzer:

{
"error": {
    "reason": "failed to find analyzer [titleAnalyzer]",
    "root_cause": [
        {
            "reason": "[elastisearch][127.0.0.1:9300][indices:admin/analyze[s]]",
            "type": "remote_transport_exception"
        }
    ],
    "type": "illegal_argument_exception"
},
"status": 400
}

Solution

  • If you call /_analyze on the root path the analyzer is not found, try specifying at least one existing index on the path

    $ echo 'A drop in the ocean'| http :5600/some_index/_analyze?analyzer=titleAnalyzer
                                                  ^
                                                  |
                                          add an index here