Hi,
In case of multi Index approach, if the data for the specific index is not present in the Elastic [index is empty]. while doing the aggregation in multi index it should return at least doc_count as '0' .
tried solution :- have tried giving "min_doc_count": 0 in aggregation . but still it's not returning anything for the index.
Query for reference :-
GET index1,index2,index3/_search
{
"from": 0,
"size": 39,
"query": {
"bool" : {
"should": [
{
"bool": {
"must": [
{
"match": {
"id1": 0
}
}
],
"filter": [
{
"terms": {
"_index": [
"index1"
]
}
}
]
}
},
{
"bool": {
"filter": [
{
"terms": {
"_index": [
"index2"
]
}
}
]
}
},
{
"bool": {
"filter": [
{
"terms": {
"_index": [
"index3"
]
}
}
]
}
}
]
}
},
"sort":{"_index":{"order":"asc"}},
"aggs":{"index1,index2,index3":{"terms":{"field": "_index","min_doc_count": 0, "size":6,"order": {"_key": "asc"}}}}
}
Issue :-
in above query suppose the data present for all index except "index1"
while returning the data it's returning doc_count for all except "index1"
but we are expecting the index1 should return doc_count : 0 event though no data present in it .
please advice any solution for this.