How to get data in chunks with collapsed fields

Hi,

I'm trying to apply the pagination over the data set.

USE_CASE: My main use case is to get the data and take the top hit according to a particular field.
Methods tried:
Method 1: Was using the aggregations, but it's a very heavy operation and the buckets were getting sorted according to "_score", whereas in the query I had applied some other filters. I was able to use after but unable to apply any sorting on buckets.

Method 2: Using collapseFields to get the fields, but I'm unable to use the scroll or searchAfter. The query becomes very slow when the (size + from) increases.

Is there any way I can speed it up?

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