pyes Search 的sort用法

来源:互联网 发布:网络销售是不是传销 编辑:程序博客网 时间:2024/06/09 13:37
pyes search 的用法es = ES(server="localhost")index='test_index'ITEM_TYPE='test_type'q={"match_all":{}}offset = 0size= 100sort 排序:升序:'price:asc'降序:'price:desc'多个排序条件:'price:asc,time:desc'es.search(q, index, ITEM_TYPE, start=offset, size=limit, sort='price:asc')

pyes 底层请求实现,是通过模拟curl 请求,形式如下:
curl -XGET http://localhost:9200/test_index/test_type/_search?sort&price:ascstart&0from&0size&100 -d ‘{“query”: {“match_all”:{}}}’

源码地址:https://github.com/aparo/pyes/blob/master/pyes/es.py