I'm trying to implement autocomplete with EslasticSearch and I follow search-as-you-type documentation:
When I run a mapping query below I get an exception.
PUT my-index-000001
{
"mappings": {
"properties": {
"my_field": {
"type": "search_as_you_type"
}
}
}
}
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "No handler for type [search_as_you_type] declared on field [my_field]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: No handler for type [search_as_you_type] declared on field [my_field]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "No handler for type [search_as_you_type] declared on field [my_field]"
}
},
"status": 400
}
Is it documentation providing wrong mapping query or it's me doing something wrong?
search_as_you_type
type field was introduced in 7.2 version
Since you are using elasticsearch version 5, you are getting the below error
"reason": "No handler for type [search_as_you_type] declared on field [my_field]