Collapse inner hits


(zouxiang) #1

I use collapse to get goods with the lowest price:

GET xxx/sku/_search
{
  "from": 0,
  "size": 10,
  "sort": [
    {
      "firstUpTime": {
        "order": "desc"
      }
    }
  ],
  "collapse": {
    "field": "goodsWebSpu",
    "inner_hits": {
      "name": "skus",
      "size": 1,
      "sort": [
        {
          "displayPrice": {
            "order": "asc"
          }
        }
      ]
    }
  }
}

It works correctly but it's too expensive for the cluster to execute this query.

https://www.elastic.co/guide/en/elasticsearch/reference/5.5/search-request-collapse.html
The office document says,

The expansion of the group is done by sending an additional query for each inner_hit request for each collapsed hit returned in the response. This can significantly slow things down if you have too many groups and/or inner_hit requests.

My test result:

Is there any more efficient way to do this?


(system) #2

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