elasticsearch [无法更新映射] [未找到MapperParsingException [Analyzer]

时间:2016-03-16 14:11:09

标签: elasticsearch

我正在开发一个ES插件,其中包含一个新的分析器和一个新的过滤器。 我的elasticsearch.yml文件如下 - :

index:
    analysis:
        analyzer:
            ik_syno:
                tokenizer: ik
                filter: [my_synonym_filter_ik]
            ik_syno_smart:
                tokenizer: ik_smart
                filter: [my_synonym_filter_ik_smart]
        filter:
            my_synonym_filter_ik_smart:
                type: org.elasticsearch.index.analysis.SynonymcnTokenFilterFactory
                use_smart: true
            my_synonym_filter_ik:
                type: org.elasticsearch.index.analysis.SynonymcnTokenFilterFactory
                use_smart: true

SynonymcnTokenFilterFactory 是我的班级。

现在,当我使用

http://127.0.0.1:9200/newshuoshuo/_analyze?analyzer=ik_syno_smart&pretty=true

分析仪' ik_syno_smart'按预期工作。

 {
      "tokens" : [ {
        "token" : "hello",
        "start_offset" : 1,
        "end_offset" : 6,
        "type" : "ENGLISH",
        "position" : 1
      } ]
    }

但是当我在我的映射调用中使用它时,它会返回错误。

这是我的索引字段

 "content": {
      "type": "string",
      "index_analyzer": "ik_syno_smart",
      "search_analyzer": "ik_smart",
      "boost": "10"
    },

错误日志如下:

on [shard failure [failed to update mappings][MapperParsingException[Analyzer [ik_syno_smart] not found for field [content]]]]

我做错了什么? 我的ES版本是1.7.0。

1 个答案:

答案 0 :(得分:1)

你总是必须在所有机器上安装插件,否则ES将无法完成他的工作,因为当索引拆分为多台机器时,他们负责工作。 另外如果你使用很多插件,那么在elasticsearch.yml中有很好的属性

plugin.mandatory: mapper-attachments,lang-groovy

这将无法启动您的ES,直到您安装所有插件。不幸的是,它还无法自动设置它们,但它会阻止您忘记的事情

相关问题