1
votes

I am developing an ES Plugin which contains a new analyzer and a new filter. My elasticsearch.yml file is as follows- :

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 is my class.

Now,when i use

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

the analyzer 'ik_syno_smart' works as expected.

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

But when i use it in my mappings call, it returns error.

This is my index field

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

The error log is as follows:

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

What is it that I'm doing wrong? My ES version is 1.7.0.

1
Please show the query you're sending to create your index and/or mapping.Val
Can you please post mapping from index?Vova Bilyachat
It is Ok now,i have one master node and two slave nodes.the slave nodes in different machines.i only updated the master,so the master node has the new analyzer and the salve node still have the old one.after i updated the slave nodes' plugin,it was ok . But i still have a question,i think the master analyze the word,but the slave nodes only store data,does it need the analysis plugin too?HaiBin

1 Answers

1
votes

You always must have installed plugins across all machines other wise ES will not be able to do his job since when index is splited to multiple machine they are responsible for work. In addition if you are using many plugins then in elasticsearch.yml there is nice property

plugin.mandatory: mapper-attachments,lang-groovy

This will not start your ES untill you install all plugins. Unfortunately its not yet able to setup them automatically but it will prevent from something you can forget