2013-09-24 32 views
0

添加以下到我的elasticsearch.ymlElasticSearch修改分析儀不工作[停用詞]

# Index Settings 
index: 
    analysis: 
    analyzer: 
     # set standard analyzer with no stop words as the default for both indexing and searching 
     default: 
     type: standard 
     stopwords: _none_ 

現在,我做了以下內容:

curl -XGET 'localhost:9200/_analyze?analyzer=default' -d 'this is a test' 

,還是把:

{ 
    "tokens": [ 
    { 
     "token": "test", 
     "start_offset": 10, 
     "end_offset": 14, 
     "type": "<ALPHANUM>", 
     "position": 4 
    } 
    ] 
} 

我想要所有的單詞都在那裏!

sudo /usr/local/elasticsearch/elasticsearch-0.90.0/bin/service/elasticsearch64 restart 

回答

0

試試這個設置代替,(而不是沒有,在禁用詞部分使用空字符串)

# Index Settings 
index: 
    analysis: 
    analyzer: 
     # set standard analyzer with no stop words as the default for both indexing and searching 
     default: 
     type: custom 
     tokenizer: standard 
     filter: [standard,lowercase] 

請注意,您需要重新啓動:不,我是通過運行elasticsearch彈性搜索服務一旦你做出這個改變。

+0

sudo /usr/local/elasticsearch/elasticsearch-0.90.0/bin/service/elasticsearch64 restart 正在停止ElasticSearch ... 已停止ElasticSearch。 啓動ElasticSearch ... 等待ElasticSearch ...... 運行:PID:14633 [ec2-user @ ip-10-169-4-9 config] $ curl -XGET'localhost:9200/_analyze?分析儀=默認'-d'這是一個測試' {「tokens」:[{「token」:「test」,「start_offset」:10,「end_offset」:14,「type」:「」,「position 「:4}]} [ec2-user @ ip-10-169-4-9 config] $ – abisson

+0

仍然無法正常工作... – abisson

+0

對不起,在這種情況下分析器類型必須自定義(如果您想要改變默認行爲)。在那裏你可以指定所需的標記器和過濾器。請看我編輯的答案。在過濾器中停止已被刪除。默認的標準分析儀附帶標準,小寫和停止過濾器。 –