How to implement auto-complete in elasticsearch -


i need implement auto-complete feature in field called "names" in document. here suggest query using that:

{ "autosuggest": { "text": "word", "completion": { "field": "names" } } } 

im getting following error running query:

{ "_shards":{ "total":5, "successful":0, "failed":5, "failures":[ { "index":"myindex", "shard":0, "reason":"broadcastshardoperationfailedexception[[names][0] ]; nested: elasticsearchexception[failed execute suggest]; nested: classcastexception[org.elasticsearch.index.mapper.core.stringfieldmapper cannot cast org.elasticsearch.index.mapper.core.completionfieldmapper]; " } .... ] } 

what reason error? , should enable auto-complete?

you need define suggester in mapping first , makes sense call out in _suggest api. can refer more on subject here.


Comments

Popular posts from this blog

java - BeanIO write annotated class to fixedlength -

Using Java 8 lambdas/transformations to combine and flatten two Maps -

How to connect android app to App engine -