Facet after distinct => facet after collapse


I struggle to migrated from Algolia to Elasticsearch.
My problem is facet after distinct option. I successfuly collapse my index to distinct by an attribute but there is a problem with the facets. The facets have the wrong number of items but when i count the result is good (collapse works)

There is my params that i use with the attribute for distinct "sku" :

  "query": {
    "match_all": {}
  "collapse": {
    "field": "sku"
  "aggs": {
    "skus_after_collapsing": {
      "terms": {
        "field": "sku.keyword"

My mapping for the filed "sku" :

"sku": {
    "type": "keyword"

Do someone have an idea ?


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.