Problem description

The following error message is returned when I use the sorting or aggregation feature of a search index:

Message: Search engine: [groupby_field] field:xx must enable enable_sort_and_agg, but enable_sort_and_agg is not enabled

Cause

When you created the search index, you did not enable sorting and aggregation for the fields based on which you want to perform queries.

Solution

Use the search index feature that allows you to dynamically modify the schema to enable sorting and aggregation for the fields based on which you want to perform queries. For more information, see Dynamically modify schemas.