Configuring built-in analyzers(配置内置分析器)
内置分析器可以直接使用,无需任何配置。然而,其中一些配置选项用来改变其行为。例如,standard(标准)分析器可以配置为支持停止词列表:
PUT my_index{"settings": {"analysis": {"analyzer": {"std_english": { #1"type": "standard","stopwords": "_english_"}}}},"mappings": {"my_type": {"properties": {"my_text": {"type": "text","analyzer": "standard", #2"fields": {"english": {"type": "text","analyzer": "std_english" #3}}}}}}}POST my_index/_analyze{"field": "my_text", #4"text": "The old brown cow"}POST my_index/_analyze{"field": "my_text.english", #5"text": "The old brown cow"}
| 1 | 我们将std_english分析器定义为基于standard(标准)分析器,但是配置为删除预定义的英文停止词列表。 | | 2,4 | my_text字段直接使用standard(标准)分析器,无需任何配置。这个字段没有停止词会被删除。所得的词语是:[the,old,brown,cow] | | 3,5 | my_text.english字段使用std_english分析器,因此英文停止词将被删除。得出的结论是:[old,brown.cow] |
原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.3/getting-started.html(修改该链接为官网对应的链接)
译文链接 : http://www.apache.wiki/display/Elasticsearch(修改该链接为 ApacheCN 对应的译文链接)
