[Spike] Facet navigation / pagination


The work done as part of excluded the offset parameter from the facet management. The offset, together with the limit parameter, is used for managing the facets navigation.

Unfortunately, the current REST API are tied to the Solr implementation (the offset and limit map 1 to 1 the parameters provided by Solr) but Elasticsearch doesn't provide the same interface.

There are three different approaches that need to be investigated:

  • Composite Aggregations [1]: this sounds like the ideal approach, the drawback is that it requires a change in the offset management, which becomes a cursor that can be used for browsing the facet pages. The client must pass back and forth the cursor in order to go to the next page. As a consequence of that, it's no longer possible to jump to an arbitrary offset

  • Partitions [2]: even if the parameters needed for dividing the facets in partitions are numeric, they behave in a different way
    Bucket Sort Aggregation: included for completeness even if I don't think that can cover the requirement. The sort is executed after all other parent aggregations. This means the sorting only applies to whatever buckets are returned from the parent aggregation. For example, if the parent aggregation is terms and its size is set to 50, it will only sort over those 50 buckets

Acceptance Criteria

  • Investigate over the three approaches above

  • Design the solution

  • Document the changes required in the REST API

  • Create the implementation stories

[1] https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html#_pagination
[2] https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-bucket-terms-aggregation.html#_filtering_values_with_partitions




andrea gazzarini



Release Train


Delivery Team