【问题标题】:ElasticSearch failed to find analyzer?ElasticSearch 找不到分析器?
【发布时间】:2016-08-29 23:10:11
【问题描述】:

我在 elasticsearch.yml 中配置了我的全局自定义分析器,这是我的配置:

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

然后我通过运行命令 $ echo 'A drop in the ocean'| http :5600/_analyze?analyzer=titleAnalyzer 来测试我的分析器

但elasticsearch告诉我它找不到分析器:

{
"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
}

【问题讨论】:

  • 运行curl -XGET localhost:9200/your_index 会得到什么?另外,您似乎缺少上面的标记器定义,您可以添加它吗?
  • 我已经在 ES 2.3.2 上尝试了您的上述配置(在修复了一些错别字之后),它对我来说很好,并产生了预期的令牌。

标签: elasticsearch elasticsearch-plugin elasticsearch-2.0


【解决方案1】:

如果您在根路径上调用/_analyze 未找到分析器,请尝试在路径上指定至少一个现有索引

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

【讨论】:

  • 非常感谢您的帮助,终于解决了,但是,我为什么不需要索引?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-27
  • 2011-07-19
  • 2014-02-15
相关资源
最近更新 更多