Elasticsearch使用多个范围进行查询,在bool查询must子句下,无需将其包装在中and。
curl -XPOST -H 'Content-Type: application/json' 'localhost:9200/assistant_dialog_202010/_search?pretty' -d '
{
"size": 20,
"query": {
"bool": {
"must": [{
"range": {
"durationTime": {
"gte": 3
}
}
}, {
"range": {
"startTime": {
"gte": 1603296000
}
}
}
],
"filter": [{
"term": {
"assistantId": "711811"
}
}
]
}
}
}
' > assistant_dialog_20201022_711811_20.txt