I have the following field and values for my documents:
publication_year : 2000, 2001, 2002, ..., 2020
I'd like to aggregate by publication_year , return the top 5 buckets, but also add specific buckets to the result (selected by the user), even if they are not among the top 5 buckets.
If you want to do this in a single aggregation, you would increase the size of the agg to include all possible unique values. Alternatively, you could use a Terms agg with size 5 + a Terms agg with the include parameter, or you could use a Terms agg + Filters agg to get the Top 5 values + specific values.
I don't have a lot more insight into the performance than you do, as I'm primarily a Kibana developer. The biggest performance factor is the number of shards that will be included in the request, and I think both of these queries need to collect information from all the shards.
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.