0

Lets say i have a DB with 2 fields - name and age.

I am using a suggest query for the name, but I would like to get the age in same request.

For example want the next query to return the age as well -

query = {

'suggest': {
    'my_suggestion': {
        'text': 'Mark',
        'term': {
            'field': 'name'
        }
    }
}

}

rullll
  • 23
  • 6
  • try following the docs first https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html – Yash Kumar Atri Sep 30 '18 at 15:43
  • I have read the docs, I did not find there how to get data from other fields (basically extracting the whole row). – rullll Sep 30 '18 at 19:44

1 Answers1

0

Term suggester doesn't support returning of other fields. If it is suitable for your case, you could switch to completion suggester, which returns standard _source field by default and supports source filtering.

Alexey Prudnikov
  • 1,083
  • 12
  • 11