WARNING: The 2.x versions of Elasticsearch have passed their EOL dates. If you are running a 2.x version, we strongly advise you to upgrade.
This documentation is no longer maintained and may be removed. For the latest information, see the current Elasticsearch documentation.
Sorting Multivalue Buckets
editSorting Multivalue Buckets
editMultivalue buckets—the terms
, histogram
, and date_histogram
—dynamically produce many buckets. How does Elasticsearch decide the order that
these buckets are presented to the user?
By default, buckets are ordered by doc_count
in descending order. This is a
good default because often we want to find the documents that maximize some
criteria: price, population, frequency. But sometimes you’ll want to modify this sort order, and there are a few ways to
do it, depending on the bucket.