admin管理员组文章数量:1123769
I have an elastic query as below:
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "my search term",
"fields": [
"title",
"keywords",
"text"
]
}
}
],
"filter": [
{
"terms": {
"catid": [
83
]
}
},
{
"range": {
"updateDate": {
"gte": "now/d-30d",
"lte": "now/d"
}
}
}
]
}
},
"aggs": {
"global_aggregation": {
"global": {},
"aggs": {
"filtered_aggregation": {
"filter": {
"bool": {
"must": [
{
"multi_match": {
"query": "my search term",
"fields": [
"title",
"keywords",
"text"
]
}
},
{
"terms": {
"status": [
2
]
}
}
]
}
},
"aggs": {
"by_time_period": {
"date_histogram": {
"field": "updateDate",
"calendar_interval": "quarter",
"format": "yyyy-MM-dd",
"order": {
"_key": "desc"
}
},
"aggs": {
"top_hits_per_bucket": {
"top_hits": {
"size": 10,
"_source": [
"title",
"msid",
"keywords",
"updateDate"
]
}
}
}
}
}
}
}
}
},
"size": 0,
"_source": [
"title",
"msid",
"keywords",
"updateDate"
]
}
Now the problem is that in the aggregated results I am getting the date_histogram for results only for the last 30 days but the global aggregations should ignore the range query in the main search. What Can I do to fix this query? If I remove the range filter from main query I get the date histograms for all the past years since beginning
本文标签:
版权声明:本文标题:elasticsearch - Date range filter not getting excluded from date histogram under global aggregations in elastic query - Stack Ov 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736586465a1945018.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论