elasticsearch Elasticsearch中的自定义预定义停止词列表,elasticsearch,lucene,stop-words,elasticsearch,Lucene,Stop Words" /> elasticsearch Elasticsearch中的自定义预定义停止词列表,elasticsearch,lucene,stop-words,elasticsearch,Lucene,Stop Words" />

elasticsearch Elasticsearch中的自定义预定义停止词列表

elasticsearch Elasticsearch中的自定义预定义停止词列表,elasticsearch,lucene,stop-words,elasticsearch,Lucene,Stop Words,如何全局定义自定义停止字列表,使其可以从所有索引访问 最好像使用预定义的特定于语言的停止词列表一样使用此停止词列表: PUT /my_index { "settings": { "analysis": { "filter": { "my_stop": { "type": "stop", "stopwords": "_my_p

如何全局定义自定义停止字列表,使其可以从所有索引访问

最好像使用预定义的特定于语言的停止词列表一样使用此停止词列表:

PUT /my_index
{
    "settings": {
        "analysis": {
            "filter": {
                "my_stop": {
                    "type":       "stop",
                    "stopwords":  "_my_predefined_stopword_list_"
                }
            }
        }
    }
}

官方的ElastCasearch文档描述了如何使用stopwords列表创建自定义过滤器。您可以在此处找到描述:

定义此过滤器后,您可以在索引定义中使用它

PUT /my_index
{
  "settings": {
    "analysis": {
      "filter": {
        "spanish_stop": {
          "type":        "stop",
          "stopwords": [ "si", "esta", "el", "la" ]  
        },
        "light_spanish": { 
          "type":     "stemmer",
          "language": "light_spanish"
        }
      },
      "analyzer": {
        "my_spanish": {
          "tokenizer": "spanish",
          "filter": [ 
            "lowercase",
            "asciifolding",
            "spanish_stop",
            "light_spanish"
          ]
        }
      }
    }
  }
}