How to sort on '_explanation' from query search

I am trying to sort on the '_explanation' field returned from my search query. Elasticsearch is not finding the field and is sorting on infinity instead. I was wondering if there is a solution for this?

results = es.search(index="index", size=50, body={'explain':True,'query': {"function_score": {
"query": {
'bool': {'should': [
{'constant_score': {'filter': {'multi_match': {'query': 'hello', "fields":['field1','field2']}}}}]}
},
"functions": [{
"field_value_factor": {
"field": "field3",
"factor": 1
}
},
{"field_value_factor": {
"field": "field4",
"factor": 1
}}
],
"score_mode": "sum",
"boost_mode": "replace"
}
},

                                           'sort': [{'_explanation.value':{"order":"desc","unmapped_type":"float"}}]
                                           , "track_scores":True})

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