pyes search 的用法
es = ES(server="localhost")
index='test_index'
ITEM_TYPE='test_type'
q={"match_all":{}}
offset = 0
size= 100
sort 排序:
升序:'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”:{}}}’