group method

  1. @Assert('field != null', 'Field name to group results on must not be null')
  2. @Assert('size == null || (size != null && size >= 1 && size <= 10', 'size must be between 1 and 10')
ElasticQuery group(
  1. String field, {
  2. int? size,
})

Takes a field with an optionnal size, creates and returns a new ElasticQuery which will return grouped results based on shared fields.

See https://www.elastic.co/guide/en/app-search/current/grouping.html

Implementation

@Assert('field != null', 'Field name to group results on must not be null')
@Assert('size == null || (size != null && size >= 1 && size <= 10',
    'size must be between 1 and 10')
ElasticQuery group(
  String field, {
  int? size,
}) {
  return copyWith(
    groupBy: _ElasticGroup(
      field: field,
      size: size,
    ),
  );
}