es查询语句

https://www.cnblogs.com/zys-blog/p/13207196.html

import requests
import json

query = {
“size”:1,
“sort”:[{“table_id9.date2″:”desc”}],
“query”:{“match”:{“app_name”:”xiaoshouleihetong”}}
}
query2 = {
“size”:1,
“sort”:[{“table_id9.date2″:”desc”}],
“query”:{“range”:{“process.created_at”:{“gte”:”2020-01-01″,”lte”:”now”,”format”:”yyyy-MM-dd”}},”match”:{“app_name”:”xiaoshouleihetong”}}
}

query = {
“size”:1,
“sort”:[{“table_id9.date2″:”desc”}],
“query”:{“bool”:{“must”:[{“match”:{“app_name”:”xiaoshouleihetong”}},
{“terms”: {“process.status”:[“start”,”finish”]}},
{“range”:{“table_id9.date2”:{“from”:”2020-10-01″}}}]}}
}

query2 ={
“query”:{“match”:{“_id”:”xiaoshouleihetong_387490″}}
}
query2={“size”:0,”query”:{“bool”:{“must”:[{“terms”:{“process.status”:[“start”,”finish”]}}],”must”:[{“bool”:{“should”:[{“term”:{“process.monitor_handlers”:”w”}} ]}},{“term”:{“app_name”:”xiaoshouleihetong”}}]}},”aggs”:{“nestedAggs”:{“nested”:{“path”:”table_id9″},”aggs”:{“groupby”:{“date_histogram”:{“interval”:”quarter”,”min_doc_count”:”1″,”script”:”if(doc[‘table_id9.date2’].isEmpty()){return 0}else{return doc[‘table_id9.date2’]}”},”aggs”:{“aggsfield”:{“sum”:{“field”:”table_id9.double1″}}}}}}}}

Leave a Reply

Your email address will not be published. Required fields are marked *