2016-05-04 105 views
1

我配置elasticsearch.yml我的全球定製分析,這裏是我的配置:ElasticSearch未能找到分析器?

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 
} 
+0

運行'curl -XGET localhost:9200/your_index'時會得到什麼?也似乎你錯過了上面的標記器定義,你可以添加它嗎? – Val

+0

我已經在ES 2.3.2上試過了你的配置(修復了一些拼寫錯誤之後),它對我來說工作正常,並且產生了預期的標記。 – Val

回答

7

如果你的根路徑分析儀沒有發現叫/_analyze,嘗試路徑上指定至少一個現有索引

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

非常感謝您的幫助,最後我解決了它,但是,我不是爲什麼需要索引? –