Class FieldCollapseDescriptor<T>
Allows to collapse search results based on field values.
The collapsing is done by selecting only the top sorted document per collapse key.
For instance the query below retrieves the best tweet for each user and sorts them by number of likes.
NOTE: The collapsing is applied to the top hits only and does not affect aggregations.
Inheritance
FieldCollapseDescriptor<T>
Assembly: OpenSearch.Client.dll
Syntax
public class FieldCollapseDescriptor<T> : DescriptorBase<FieldCollapseDescriptor<T>, IFieldCollapse>, IDescriptor, IFieldCollapse where T : class
Type Parameters
Methods
|
Edit this page
View Source
Field(Field)
The field used for collapsing must be a single valued keyword or number field with doc-values activated
Declaration
public FieldCollapseDescriptor<T> Field(Field field)
Parameters
Type |
Name |
Description |
Field |
field |
|
Returns
|
Edit this page
View Source
Field<TValue>(Expression<Func<T, TValue>>)
The field used for collapsing must be a single valued keyword or number field with doc-values activated
Declaration
public FieldCollapseDescriptor<T> Field<TValue>(Expression<Func<T, TValue>> objectPath)
Parameters
Returns
Type Parameters
|
Edit this page
View Source
InnerHits(Func<InnerHitsDescriptor<T>, IInnerHits>)
It is also possible to expand each collapsed top hits with the inner_hits
option.
Declaration
public FieldCollapseDescriptor<T> InnerHits(Func<InnerHitsDescriptor<T>, IInnerHits> selector = null)
Parameters
Returns
|
Edit this page
View Source
MaxConcurrentGroupSearches(int?)
The expansion of the group is done by sending an additional query for each inner_hit request for each collapsed hit returned
in the response. This can significantly slow things down if you have too many groups and/or inner_hit requests.
The max_concurrent_group_searches request parameter can be used to control the maximum number of
concurrent searches allowed in this phase. The default is based on the number of data nodes and the
default search thread pool size.
Declaration
public FieldCollapseDescriptor<T> MaxConcurrentGroupSearches(int? maxConcurrentGroupSearches)
Parameters
Type |
Name |
Description |
int? |
maxConcurrentGroupSearches |
|
Returns
Implements
Extension Methods