Hi All,
is there a way for me to perform the aggregation for all the Matching documents inside the bool should array individually.
{
"query": {
"bool": {
"should": [
{
"multi_match": {
"fields": [
"title",
"abstract"
],
"query": "welding",
"type": "phrase",
"_name": "welding"
}
},
{
"multi_match": {
"fields": [
"title",
"abstract"
],
"query": "gmaw",
"type": "phrase",
"_name": "gmaw"
}
}
]
}
},
"aggregations": {
"dates": {
"date_histogram": {
"field": "date",
"interval": "year",
"format": "yyyy"
}
}
}
}
this will give me Doc count per Year for the Above query.
But, can I get the Aggregations separately for each query item in the should array.
I'm expecting something like this:
{
"welding": [
{
"year": 2020,
"count": 15
},
{
"year": 2019,
"count": 11
}
],
"gmaw": [
{
"year": 2020,
"count": 15
},
{
"year": 2019,
"count": 11
}
]
}
Any suggestion is Much Appreciated.
Thanks.