11

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! ;)

Wiesi
  • 183
  • 3
  • 10

1 Answers1

15

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"
                }
            }
        }
    }
  }
}
Val
  • 207,596
  • 13
  • 358
  • 360
  • How do you insert documents into this? Like this? PUT index/type1/1 { "name" : { "autocomplete": "Jose Sebastian" } } – kind_robot Jul 18 '17 at 13:24
  • @sheldon_cooper you should probably ask another question as it doesn't look like it's related. – Val Jul 18 '17 at 13:25
  • @Val too have problem in inserting data when the mapping is like above. Here is the [link](https://stackoverflow.com/questions/45508156/elasticsearch-5-mapperparserexception-while-inserting-data/45508332#45508332) to the question I have opened. Looking at your above suggestion I have updated my mappings. – Shreyas Rao B Aug 04 '17 at 13:57