弹性搜索外语停止词

时间:2013-07-28 16:57:05

标签: elasticsearch stop-words

我是Elasticsearch的新手,我正在努力进行一些测试,但是在使用(对于这种情况)法国分析仪并停止使用时,我遇到了一个问题。这是我设置的索引:

test1: {

    state: open
    settings: {
        index.analysis.analyzer.french.tokenizer: standard
        index.analysis.filter.stop_fr.stopwords.0: _french_
        index.analysis.filter.stop_fr.type: stop
        index.analysis.analyzer.french.filter.1: stop_fr
        index.analysis.analyzer.french.filter.0: lowercase
        index.analysis.analyzer.french.type: custom
        index.number_of_shards: 5
        index.number_of_replicas: 1
        index.version.created: 900299
    }

然而,当我运行“测试分析​​仪”时,来自ES Head的工具,法语停止词仍然通过,而英语停止词(a,a等)不是。任何见解将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:1)

您还应该更改索引映射设置。

default_analyzer会自动分析索引,这当然会删除英文停用词。使用两种类型的信息contenttime

进行映射的示例
"testindex": {
    "testtype": {
      "search_analyzer": "test_analyzer", // <-- search_analyzer
      "properties": {
        "content": {
          "type": "string",
          "store": true,
          "analyzer": "test_analyzer"  // <-- index_analyzer
        },
        "time": {
          "type": "date",
          "store": true,
          "format": "dateOptionalTime"
        }
      }
    }
  }
相关问题