I am using elasticsearch 6.2.3. I want to know how we can pass index name in aggregation filtering to get aggregation results for particular index. My search query currently working on multiple indices(Using one aliase name). Below is the sample -
Please help me out in this.
{
"aggs" : {
"t_shirts" : {
"filter" : { "term": { "type": "t-shirt" } }, // here I want to pass index name to filter on this aggs.
"aggs" : {
"avg_price" : { "avg" : { "field" : "price" } }
}
}
}
}
This will filter all aggregations but I need to filter only one aggregation and if we pass index name with search, then it will filter out query results as well as aggregation data and that's not what I am looking for.
As I know we can pass index name in aggregations using something like indexed filtered aggregation. But how we can do, didn't know. If anyone know, then please share query sample as it will be great helpfull...
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.