Autocomplete from multiple fields


I have an Elasticsearch index that has documents with a field StringField1, StringField2, NumberField1 etc. I need to build an autocomplete functionality that searches on all the 3 fields.


if user inputs


it should fetch all strings in the string fields that starts with pa.

if I search 99 it should fetch all values starting with 99.
I tried

"fields":["Last_Name", "LEAD_SOURCE"],

But it does not give any hits.

How can i solve this?


Finally I could Solve this with the below structure. Took some reading and googling

//			{
//				  "query": {
//				    "multi_match": {
//				      "query": "9920200",
//				      "fields": ["stringField1", "StringField2", "NumberField1",],
//				      "type" : "phrase_prefix"
//				    }
//				  }

// }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.