我的查询如下
POST user-info/_search
{
"size": 0,
"query": {
"bool": {
"must": [
{
"match_all": {}
}
],
"filter": {
"range": {
"LastModifiedDt": {
"time_zone": "-06:00",
"lt": "2020-02-20T10:00:00||/h"
}
}
}
}
},
"aggregations": {
"activeFlag": {
"meta": {
"agg_type": "terms"
},
"terms": {
"field": "activeFlg",
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": false,
"order": {
"_key": "asc"
}
}
}
}
}
到目前为止,我已经编写了以下代码。
BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder()
.must(new MatchAllQueryBuilder())
.filter(new RangeQueryBuilder("LastModifiedDt")
.timeZone("-06:00")
.lt(dateTimeOfHour + "||/h"));
但是我很难找到聚合和术语的语法。感谢您的帮助。