Package org.elasticsearch.search.sort
Class SortBuilder<T extends SortBuilder<T>>
java.lang.Object
org.elasticsearch.search.sort.SortBuilder<T>
- All Implemented Interfaces:
NamedWriteable
,Writeable
,ToXContent
,ToXContentObject
,Rewriteable<SortBuilder<?>>
- Direct Known Subclasses:
FieldSortBuilder
,GeoDistanceSortBuilder
,ScoreSortBuilder
,ScriptSortBuilder
public abstract class SortBuilder<T extends SortBuilder<T>> extends java.lang.Object implements NamedWriteable, ToXContentObject, Rewriteable<SortBuilder<?>>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields Modifier and Type Field Description static ParseField
NESTED_FILTER_FIELD
static ParseField
NESTED_PATH_FIELD
protected SortOrder
order
static ParseField
ORDER_FIELD
-
Constructor Summary
Constructors Constructor Description SortBuilder()
-
Method Summary
Modifier and Type Method Description protected abstract SortFieldAndFormat
build(QueryShardContext context)
Create a SortFieldAndFormat from this builder.abstract BucketedSort
buildBucketedSort(QueryShardContext context, int bucketSize, BucketedSort.ExtraData extra)
Create a BucketedSort which is useful for sorting inside of aggregations.static java.util.Optional<SortAndFormats>
buildSort(java.util.List<SortBuilder<?>> sortBuilders, QueryShardContext context)
static java.util.List<SortBuilder<?>>
fromXContent(XContentParser parser)
SortOrder
order()
Return theSortOrder
used for thisSortBuilder
.T
order(SortOrder order)
Set the order of sorting.protected static QueryBuilder
parseNestedFilter(XContentParser parser)
protected static IndexFieldData.XFieldComparatorSource.Nested
resolveNested(QueryShardContext context, java.lang.String nestedPath, QueryBuilder nestedFilter)
protected static IndexFieldData.XFieldComparatorSource.Nested
resolveNested(QueryShardContext context, NestedSortBuilder nestedSort)
java.lang.String
toString()
-
Field Details
-
Constructor Details
-
SortBuilder
public SortBuilder()
-
-
Method Details
-
build
Create a SortFieldAndFormat from this builder.- Throws:
java.io.IOException
-
buildBucketedSort
public abstract BucketedSort buildBucketedSort(QueryShardContext context, int bucketSize, BucketedSort.ExtraData extra) throws java.io.IOExceptionCreate a BucketedSort which is useful for sorting inside of aggregations.- Throws:
java.io.IOException
-
order
Set the order of sorting. -
order
Return theSortOrder
used for thisSortBuilder
. -
fromXContent
public static java.util.List<SortBuilder<?>> fromXContent(XContentParser parser) throws java.io.IOException- Throws:
java.io.IOException
-
buildSort
public static java.util.Optional<SortAndFormats> buildSort(java.util.List<SortBuilder<?>> sortBuilders, QueryShardContext context) throws java.io.IOException- Throws:
java.io.IOException
-
resolveNested
protected static IndexFieldData.XFieldComparatorSource.Nested resolveNested(QueryShardContext context, java.lang.String nestedPath, QueryBuilder nestedFilter) throws java.io.IOException- Throws:
java.io.IOException
-
resolveNested
protected static IndexFieldData.XFieldComparatorSource.Nested resolveNested(QueryShardContext context, NestedSortBuilder nestedSort) throws java.io.IOException- Throws:
java.io.IOException
-
parseNestedFilter
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-