Faceting after Collapse

Hi,

I struggle to migrated from Algolia to Elasticsearch.
My problem is facet after distinct option equivalent in Elasticsaerch. I successfuly collapse my index to distinct by an attribute but there is a problem with the facets. The facets counts have the wrong number of items, the no collapse's results.

I want my facets counts have the number after collapse, not before collapse.

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 ?

Thanks

Bonjour :wink:

I'm not sure I fully understood what you are getting and what you would like to get.

Could you illustrate that with a simple basic example?

Like could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script is something anyone can copy and paste in Kibana dev console, click on the run button to reproduce your use case. It will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

Have a look at the Elastic Stack and Solutions Help · Forums and Slack | Elastic page. It contains also lot of useful information on how to ask for help.

Hi Dadoonet,

Sorry how could i reproduce my problem ? it's a localy elasticsearch server.

Do you have a codesandbox or something that help me to recreate the problem ?

Thanks

The last link I shared explains that I think.

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