I need to implement auto-complete feature in a field called "names" in my document. Here is the suggest query I am using for that:
{
"autoSuggest": {
"text": "word",
"completion": {
"field": "names"
}
}
}
Im getting the following error running this query:
{
"_shards":{
"total":5,
"successful":0,
"failed":5,
"failures":[
{
"index":"myindex",
"shard":0,
"reason":"BroadcastShardOperationFailedException[[names][0] ]; nested: ElasticsearchException[failed to execute suggest]; nested: ClassCastException[org.elasticsearch.index.mapper.core.StringFieldMapper cannot be cast to org.elasticsearch.index.mapper.core.CompletionFieldMapper]; "
}
....
]
}
What is the reason for this error? and what should i do to enable the auto-complete?