2013-07-28 44 views
1

我是Elasticsearch的新手,我试图用一些测试来启动,但是在使用法语分析器和停用词语时遇到了一个问题。这是我已经建立了索引: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头,法国停用词仍然得到通过,而英语停用词(的,一个,等“测试仪”工具)不是。任何有识之士将不胜感激。谢谢!

回答

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" 
     } 
     } 
    } 
    } 
+1

实际上顶层'search_analyzer'是用于'_all'字段。字段特定的'analyzer'为该字段设置了'index_analyzer'和'search_analyzer'(字段特定查询)。你也可以指定一个顶级'index_analyzer'(用于'_all'字段)。 – ramseykhalaf