es = Elasticsearch([])
es.indices.put_settings(index='event',
body={'index':{
'max_result_window':500000}})
以上代码设置了窗口最大显示数据条数为500000;
条件查询中,同字段多值查询如下(或):
query ={
"query": {
"bool": {
"should": [
{
"match": {
'subject_type':0
}
},
{
"match": {
'subject_type':1
}
}]
}
},
"sort": [
{"timestamp": {"order": 'desc'}}],
"from": (page - 1) * size,
"size": size, }
res = es.search(index=index_name,
doc_type=doc_type,
body=query)