普通查询Dome
url:get:http://localhost:9200/{索引名称}/_search
{
"_source": [ #需要返回的字段。[] 为全部
"name"
],
"query": { #查询主题
"bool": { #相当于()
"must": [ #多条件满足
{
"term": { #单条件 相当于 =
"isDeleted": false
}
},
{
"nested": { #指定路径查 ,可查询数组中的数据
"path": "tenantInfo", #指定路径
"query": {
"exists": { # 判断是否存在字段
"field": "tenantInfo.id"
}
}
}
},
{
"bool": {
"should": [ #或者查询 可以是多条件亦可以是单挑
{
"bool": {
"should": [
{
"terms": { # 多条件满足,相当于IN
"status": [
10,
0
]
}
},
{
"term": {
"housekeeperId": "259573073785790464"
}
}
]
}
}
]
}
}
]
}
},
"sort": [ #排序
{
"updateTime": {
"order": "desc"
},
"sort": {
"order": "desc"
}
}
]
}
统计查询Dome
{
"query": { #查询主体
"bool": {
"must": [
{
"term": {
"isDeleted": false
}
},
{
"range": { #区间查询
"vacantStartDate": {
"gte": "2022-04-04",
"lte": "2022-04-18",
"format": "yyyy-MM-dd" #格式
}
}
}
],
"must_not": [ #不能成立
{
"term": {
"status": 30
}
}
]
}
},
"aggs": { #统计开始
"grodeBy": { #自定义名
"terms": {
"field": "type" 统计字段
}
}
}
}
版权声明:本文为Yester_Sun原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。