使用stopwords_path停止单词分析器无法正常工作

时间:2018-07-27 16:06:19

标签: elasticsearch match analyzer

我使用的是ES2.3,我有一个停用词文件列表,这些词混合了大写和小写形式 我正在尝试创建一个忽略停用词大小写的分析器

 "stopword_analyzer": {
      "type": "standard",
      "ignore_case": "true"
      "stopwords_path": "stopwords_english.txt"
    }

我尝试在鞋帮中使用singel停用词来检查stopwords_path argumant是否存在问题

    "stopword_analyzer6": {
      "type": "stop",
      "stopwords": "[UPPERCASE]",
      "ignore_case": "true"
    }

但这也失败了

我也尝试应用小写过滤器,但效果不佳

    "stopword_analyzer5": {
      "type": "stop",
      "stopwords_path": "stopwords_english.txt",
      "filter": [
        "lowercase"
      ]

1 个答案:

答案 0 :(得分:0)

我最终完成的工作达到了目的,在自定义分析器上使用了停用词过滤器和小写过滤器

"analysis": {
      "filter": {
        "my_stop":{
          "type": "stop",
          "ignore_case": "true",
          "stopwords_path": "stopwords_english.txt"
        }
      },
      "analyzer": {
        "stopword_analyzer7": {
          "type": "custom",
          "tokenizer": "whitespace",
          "stopwords_path": "stopwords_english.txt",
          "filter": [
            "lowercase",
            "my_stop"
          ]
        }
      }
    }
相关问题