【问题标题】:Elasticsearch Foreign Language Stop WordsElasticsearch 外语停用词
【发布时间】:2013-07-28 10:44:39
【问题描述】:

我是 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 运行“测试分析​​器”工具时,法语停用词仍在通过,而英语停用词(the、a 等)则没有。任何见解将不胜感激。谢谢!

【问题讨论】:

    标签: elasticsearch stop-words


    【解决方案1】:

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

    默认分析器会自动分析索引,这当然会删除英文停用词。具有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"
            }
          }
        }
      }
    

    【讨论】:

    • 其实顶级search_analyzer是为_all字段。特定于字段的analyzer 为该字段设置index_analyzersearch_analyzer(特定于字段的查询)。您还可以指定顶级index_analyzer(用于_all 字段)。
    猜你喜欢
    • 2018-12-19
    • 2014-02-03
    • 2013-01-16
    • 1970-01-01
    • 2020-08-02
    • 1970-01-01
    • 1970-01-01
    • 2017-07-13
    • 2015-03-12
    相关资源
    最近更新 更多