Interface TypedSearchAggregationFactory<SR>
- Type Parameters:
SR
- Scope root type.
- All Superinterfaces:
SearchAggregationFactory
- All Known Subinterfaces:
ElasticsearchSearchAggregationFactory<SR>
,ExtendedSearchAggregationFactory<SR,
,S, PDF> LuceneSearchAggregationFactory<SR>
- All Known Implementing Classes:
AbstractSearchAggregationFactory
Field paths
By default, field paths passed to this DSL are interpreted as absolute, i.e. relative to the index root.
However, a new, "relative" factory can be created with withRoot(String)
:
the new factory interprets paths as relative to the object field passed as argument to the method.
This can be useful when calling reusable methods that can apply the same aggregation on different object fields that have same structure (same sub-fields).
Such a factory can also transform relative paths into absolute paths using SearchAggregationFactory.toAbsolutePath(String)
;
this can be useful for native aggregations in particular.
Field references
Afield reference
is always represented by the absolute field path and,
if applicable, i.e. when a field reference is typed, a combination of the ValueModel
and the type.
Field references are usually accessed from the generated Hibernate Search's static metamodel classes that describe the index structure.
Such reference provides the information on which search capabilities the particular index field possesses, and allows switching between different
value model representations
.
- Author:
- Emmanuel Bernard emmanuel@hibernate.org
-
Method Summary
Modifier and TypeMethodDescriptionavg()
Perform the avg metric aggregation.count()
Perform the count metric aggregation.Perform the count distinct metric aggregation.max()
Perform the max metric aggregation.min()
Perform the min metric aggregation.range()
Perform aggregation in range buckets.sum()
Perform the sum metric aggregation.terms()
Perform aggregation in term buckets.Create a new aggregation factory whose root for all paths passed to the DSL will be the given object field.Methods inherited from interface org.hibernate.search.engine.search.aggregation.dsl.SearchAggregationFactory
extension, toAbsolutePath, withParameters
-
Method Details
-
range
RangeAggregationFieldStep<SR,?> range()Perform aggregation in range buckets.Given a field and one or more ranges of values, this aggregation creates one bucket per range, and puts in each bucket every document for which the given field has a value that falls into the corresponding range.
For each bucket, the document count is computed, or more complex metrics or sub-aggregations for backends that support it.
- Specified by:
range
in interfaceSearchAggregationFactory
- Returns:
- The next step.
-
terms
TermsAggregationFieldStep<SR,?> terms()Perform aggregation in term buckets.Given a field, this aggregation creates one bucket per term of that field in the index, and puts in each bucket every document for which the given field matches the corresponding term.
For each bucket, the document count is computed, or more complex metrics or sub-aggregations for backends that support it.
- Specified by:
terms
in interfaceSearchAggregationFactory
- Returns:
- The next step.
-
sum
Perform the sum metric aggregation.- Specified by:
sum
in interfaceSearchAggregationFactory
- Returns:
- The next step.
-
min
Perform the min metric aggregation.- Specified by:
min
in interfaceSearchAggregationFactory
- Returns:
- The next step.
-
max
Perform the max metric aggregation.- Specified by:
max
in interfaceSearchAggregationFactory
- Returns:
- The next step.
-
count
Perform the count metric aggregation.- Specified by:
count
in interfaceSearchAggregationFactory
- Returns:
- The next step.
-
countDistinct
Perform the count distinct metric aggregation.- Specified by:
countDistinct
in interfaceSearchAggregationFactory
- Returns:
- The next step.
-
avg
Perform the avg metric aggregation.- Specified by:
avg
in interfaceSearchAggregationFactory
- Returns:
- the next step.
-
withRoot
Create a new aggregation factory whose root for all paths passed to the DSL will be the given object field.See here for more information.
- Specified by:
withRoot
in interfaceSearchAggregationFactory
- Parameters:
objectFieldPath
- The path from the current root to an object field that will become the new root.- Returns:
- A new aggregation factory using the given object field as root.
-