public class Group extends DslCloneable
QueryDefinition.getGroupedQuery()
and QueryDefinition.getGroupedFilters()
could override main query
and filter queries when selecting group details.
Note: In order to use these features the documents must be located on the same shard. This could be achieved by restricting data collection to one shard, or by setting up Document Routing on indexing.
The same shard restriction could be lifted with hint "hint.grouping.method=group". But getLeaderStrategy()
,
QueryDefinition.getGroupedQuery()
and QueryDefinition.getGroupedFilters()
will be ignored;
and total number of groups will not be calculated.
To calculate total number of group with "hint.grouping.method=group", another hint has to be specified: "hint.grouping.num.found=true", but this will require the documents to be located on the same shard too.
Constructor and Description |
---|
Group(String field,
GroupLeaderStrategy leaderStrategy,
List<SortElement> sort,
Long size) |
Modifier and Type | Method and Description |
---|---|
Group |
clone() |
String |
getField() |
GroupLeaderStrategy |
getLeaderStrategy() |
Long |
getSize() |
List<SortElement> |
getSort() |
void |
setSort(List<SortElement> sort) |
clone, deepClone
public Group(String field, GroupLeaderStrategy leaderStrategy, List<SortElement> sort, Long size)
public String getField()
public GroupLeaderStrategy getLeaderStrategy()
This field is ignored with "hint.grouping.method=group". "sort" leader strategy with getSort()
order
will be used.
public List<SortElement> getSort()
public void setSort(List<SortElement> sort)
public Long getSize()
public Group clone()
clone
in class DslCloneable