I'm using ElasticSearch.net to display a list of Flight Tickets for Clients. Some of theses Clients are grouped together when we process the flight tickets. I want my list to display theses groups together no matter the sorting order.
I've tried to aggregate on the GroupId field but figured that this is not what I want. I believe aggregate is similar to Group By in SQL ?
The commented code here is what I tried:
var response = await _elastic.SearchAsync<FlightTicketRequestDocument>(search => search .Index(IndexNames.FlightTicketRequests) .AllTypes() .Query(q => q.Bool(b => b.Must(m => m.QueryString(searchQuery.Query, Fields())) .Filter(Filters(searchQuery)))) //.Aggregations(agg => agg.Terms("group_by_groupId", g => g.Field(f => f.GroupId))) .Sort(p => searchQuery.Sort != null ? p.Field(searchQuery.Sort.Member, searchQuery.Sort.SortDirection) : p) .Page(searchQuery.Page, searchQuery.PageSize), cancellationToken);
To be clear: I want to see all clients of a group next to each others no matter the sorting order of the table but I still want my sorting to work independently from GroupId