1、fileld_2字段存在与fileld_1字段不存在
GET index_1/_search
{"track_total_hits": true,
"query":{
"bool": {
"must_not":[{
"exists": {
"field": "fileld_1"
}
}], "must":[{
"exists": {
"field": "fileld_2"
}
}]
}
}
}
2、field_1字段等于aa并且field_2在bb cc集合里
GET index_1/_search
{"track_total_hits":true,
"query": {"bool": {"must": [
{"match": {
"field_1": "aa"
}},{
"terms": {"field_2":[
"bb",
"cc"
]}
}
]}}
}
3、field_1字段等于aa并且field_2在2023-01-01与2023-01-31范围内
GET index_1/_search
{
"query": {"bool": {"must": [
{"match": {
"field_1": "aa"
}},{
"range": {
"field_2": {
"gte": "2023-01-01 00:00:00",
"lte": "2023-01-31 23:59:59"
}
}
}
]}}
}