How to enable track_scores in elasticsearch-dsl python

☆樱花仙子☆ 提交于 2019-12-08 04:39:12

问题


I am using elasticsearch dsl to search on elasticsearch : https://elasticsearch-dsl.readthedocs.org/en/latest/

How can i enable track_scores for the query ?

I know its supported in elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html#_track_scores

Just dont know how to do the same in Elasticsearch-dsl


回答1:


I found this mentioned in the documentation:

http://elasticsearch-dsl.readthedocs.org/en/latest/search_dsl.html#extra-properties-and-parameters

s = s.extra(track_scores=True)

This worked.



来源:https://stackoverflow.com/questions/33799486/how-to-enable-track-scores-in-elasticsearch-dsl-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!