Group by Full Text Search

Is group by possible in FTS CB version 6.0.2? I want to apply aggregation on certain field and then sort and limit the data.

If this is possible, please help me to find the syntax for the same.


Search facets is the only form of aggregation that FTS supports and yes they should be available in 6.0.2 as well. Here’s the latest documentation on it -

Sort and Limit is available in 6.0.2 with “sort”, “from”, “size” settings in the search request.
Related -

Thanks @abhinav for suggesting facets. I already used it for aggregating the count for specific logic. Lets say facets on specific field gives 10000 keys with each having 3 data. How to get group of document ids for each 10000 groups and i want it to be paginated to get first 100 only and then next 100 like that.

Facets are built over document hits - the documents which satisfy the query criteria.
Pagination of these document IDs can be achieved by using size + from.

For example to get the first 100 keys, this is your query …

{"query": {..}, "facets": {..}, "size": 100, "from" 0}

and for the second 100 …

{"query": {..}, "facets": {..}, "size": 100, "from" 100}

and so on.

For all these queries, the facets response will remain the same, for as long as the total_hits remains the same.
Make sure to use a reasonably large number for “size” within the facets object in the search request for a partitioned index.

Hope this helps.

thanks. i will try it and get back