Find contact with aggs terms and date range and use the found contacts for another aggs with date_histogram

Hi, i'm new with Elaticsearch and I need some help for a search query.... Thanks in advance !

I've an index with docs between 2021-02-01 and 2021-04-01. I make a search query like this to retrieve phone numbers that appear between 2021-03-01 and 2021-03-02.

"aggs": {
"timeseries": {
"date_range": {
"field": "DateTime",
"time_zone": "CET",
"format": "yyyy-MM-dd",
"ranges": [ {
"from": "2021-03-01",
"to": "2021-03-02"
}]
},
"aggs": {
"PhoneNumber": {
"terms": {
"field": "Contact_ID",
"size": 10
}

this works.

But now I want to make a date_histogram aggregation with this found contacts but on all the period, that means from the 2021-02-01 to the 2021-04-01....

How can I realize this ??

Thanks a lot for your help !!!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.