Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElasticSearch 5: MapperParserException with multi_field

This mapping hast worked with ES 2.X, now with ES 5 I get an exception:

{  
"type1":{  
    "properties":{  
        "name":{  
            "type":"multi_field",
            "fields":{  
                "name":{  
                    "type":"string",
                    "index_analyzer":"standard",
                    "index":"analyzed",
                    "store":"no",
                    "search_analyzer":"standard"
                },
                "name_autocomplete":{  
                    "type":"string",
                    "index_analyzer":"autocomplete",
                    "index":"analyzed",
                    "store":"no",
                    "search_analyzer":"standard"
                }
            }
        }
    }
}

}

The exception is:

No handler for type [multi_field] declared on field [name]

Someone an idea? Thanks! ;)

like image 409
Wiesi Avatar asked Oct 28 '16 08:10

Wiesi


1 Answers

multi-field was deprecated in ES 1.x and completely removed in ES 5.x.

Now multi fields are supported via the use of fields which you can specify like this:

{  
  "type1":{  
    "properties":{  
        "name":{  
            "type":"text",
            "analyzer":"standard",
            "index":"analyzed",
            "store":"no",
            "search_analyzer":"standard"
            "fields": {
                "autocomplete":{  
                    "type":"text",
                    "analyzer":"autocomplete",
                    "index":"analyzed",
                    "store":"no",
                    "search_analyzer":"standard"
                }
            }
        }
    }
  }
}
like image 135
Val Avatar answered Oct 02 '22 05:10

Val