Can I customize Elastic Search to use my own Stop Word list?

孤街醉人 提交于 2019-11-29 17:54:37

问题


specifically, I want to index everything (e.g. the who) with no stop word list. Is elastic search flexible enough and easy enough to change?


回答1:


By default, the analyzer elasticsearch uses is a standard analyzer with the default Lucene English stopwords. I have configured elasticsearch to use the same analyzer but without stopwords by adding the following to the elasticsearch.yml file.

# 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_



回答2:


Yes, you can do this using ElasticSearch's internal config YAML file.

See the config docs for how to change the analyzer settings.




回答3:


You can override default analyzer globally and turn off the stopword filter by adding these lines to your elasticsearch.yml:

index.analysis.analyzer.default:
  type: custom
  tokenizer: standard
  filter: standard, lowercase

This will create a custom analyzer with the standard tokenizer and two filters: standard and lowercase. This way your custom analyzer will be identical to the standard analyzer but it will not use the stopword filter. Because it's named "default", elasticsearch will use it everywhere where analyzer is not explicitly set.




回答4:


Certainly you can. Use stopwords_path insead of stopwords. for more information http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-stop-analyzer.html



来源:https://stackoverflow.com/questions/4927629/can-i-customize-elastic-search-to-use-my-own-stop-word-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!