2017-07-09 22 views
0

我希望向默認的「英語」添加更多單詞,例如「inc」,「incorporated」,「ltd」和「limited」。我怎樣才能做到這一點?如何將停用詞添加到ElasticSearch中的默認列表中

我目前創建索引的代碼如下。謝謝。

PUT /my_index 
{ 
    "settings": { 
    "analysis": { 
     "filter": { 
     "my_stop": { 
      "type": "stop", 
      "stopwords": "_english_" 
     } 
     }, 
     "analyzer": { 
     "my_analyzer": { 
      "tokenizer": "whitespace", 
      "char_filter": [ 
      "html_strip" 
      ], 
      "filter": [ 
      "lowercase", 
      "asciifolding", 
      "my_stop" 
      ] 
     } 
     } 
    } 
    } 
} 

我的測試碼

POST my_index/_analyze 
{ 
    "analyzer": "my_analyzer", 
    "text": "House of Dickson<br> corp" 
} 

回答

1

該組 「英語」 停止詞是相同Standard Analyzer集合。

您可以創建這些話,你的額外停用詞文件,並使用stopwords_path選項指向此文件(而不是stopwords設置):

{ 
    "settings": { 
    "analysis": { 
     "filter": { 
     "my_stop": { 
      "type": "stop", 
      "stopwords_path": "stopwords/custom_english.txt" 
     } 
     }, 
     ... 
} 

你可以找到更多信息的文件看起來應該像在ES-docs(UTF-8,每行單個停用詞,所有節點上都存在文件)。

+0

謝謝。如果我使用Elastic Cloud(沒有在本地安裝ES),是否可以創建自定義停用字詞文件? – Redzon

+0

我不使用Elastic Cloud,但我認爲您需要在[Elastic Support Portal](https://support.elastic.co/customers/s/login/)中申請支持憑單。類似的情況在這裏:[stopwords list upload](https://discuss.elastic.co/t/please-activate-synonyms-and-stopwords-list-upload/88124)。 – Joanna

相關問題