public class FieldSortBuilder extends SortBuilder<FieldSortBuilder>
Writeable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DOC_FIELD_NAME
special field name to sort by index order
|
static ParseField |
MISSING |
static java.lang.String |
NAME |
static ParseField |
SORT_MODE |
static ParseField |
UNMAPPED_TYPE |
NESTED_FILTER_FIELD, NESTED_PATH_FIELD, order, ORDER_FIELD
EMPTY_PARAMS
MAX_REWRITE_ROUNDS
Constructor and Description |
---|
FieldSortBuilder(FieldSortBuilder template)
Copy constructor.
|
FieldSortBuilder(StreamInput in)
Read from a stream.
|
FieldSortBuilder(java.lang.String fieldName)
Constructs a new sort based on a document field.
|
Modifier and Type | Method and Description |
---|---|
SortFieldAndFormat |
build(QueryShardContext context)
Create a @link
SortFieldAndFormat from this builder. |
boolean |
equals(java.lang.Object other) |
static FieldSortBuilder |
fromXContent(XContentParser parser,
java.lang.String fieldName)
|
java.lang.String |
getFieldName()
Returns the document field this sort should be based on.
|
QueryBuilder |
getNestedFilter()
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder) and retrieve with getNestedSort() |
java.lang.String |
getNestedPath()
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder) and retrieve with getNestedSort() |
NestedSortBuilder |
getNestedSort()
Returns the
NestedSortBuilder |
java.lang.String |
getWriteableName()
Returns the name of the writeable object
|
int |
hashCode() |
java.lang.Object |
missing()
Returns the value used when a field is missing in a doc.
|
FieldSortBuilder |
missing(java.lang.Object missing)
Sets the value when a field is missing in a doc.
|
FieldSortBuilder |
rewrite(QueryRewriteContext ctx)
Rewrites this instance based on the provided context.
|
FieldSortBuilder |
setNestedFilter(QueryBuilder nestedFilter)
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder) and retrieve with getNestedSort() |
FieldSortBuilder |
setNestedPath(java.lang.String nestedPath)
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder) and retrieve with getNestedSort() |
FieldSortBuilder |
setNestedSort(NestedSortBuilder nestedSort)
Sets the
NestedSortBuilder to be used for fields that are inside a nested
object. |
SortMode |
sortMode()
Returns what values to pick in the case a document contains multiple
values for the targeted sort field.
|
FieldSortBuilder |
sortMode(SortMode sortMode)
Defines what values to pick in the case a document contains multiple
values for the targeted sort field.
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
java.lang.String |
unmappedType()
Returns the type to use in case the current field is not mapped in an
index.
|
FieldSortBuilder |
unmappedType(java.lang.String type)
Set the type to use in case the current field is not mapped in an index.
|
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
buildSort, fromXContent, order, order, parseNestedFilter, resolveNested, resolveNested, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
rewrite, rewrite, rewrite, rewriteAndFetch, rewriteAndFetch
public static final java.lang.String NAME
public static final ParseField MISSING
public static final ParseField SORT_MODE
public static final ParseField UNMAPPED_TYPE
public static final java.lang.String DOC_FIELD_NAME
public FieldSortBuilder(FieldSortBuilder template)
public FieldSortBuilder(java.lang.String fieldName)
fieldName
- The field name.public FieldSortBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
java.io.IOException
public java.lang.String getFieldName()
public FieldSortBuilder missing(java.lang.Object missing)
public java.lang.Object missing()
public FieldSortBuilder unmappedType(java.lang.String type)
public java.lang.String unmappedType()
public FieldSortBuilder sortMode(SortMode sortMode)
The last two values are only applicable for number based fields.
public SortMode sortMode()
@Deprecated public FieldSortBuilder setNestedFilter(QueryBuilder nestedFilter)
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
@Deprecated public QueryBuilder getNestedFilter()
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
@Deprecated public FieldSortBuilder setNestedPath(java.lang.String nestedPath)
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
@Deprecated public java.lang.String getNestedPath()
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
public NestedSortBuilder getNestedSort()
NestedSortBuilder
public FieldSortBuilder setNestedSort(NestedSortBuilder nestedSort)
NestedSortBuilder
to be used for fields that are inside a nested
object. The NestedSortBuilder
takes a `path` argument and an optional
nested filter that the nested objects should match with in
order to be taken into account for sorting.public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException
public SortFieldAndFormat build(QueryShardContext context) throws java.io.IOException
SortBuilder
SortFieldAndFormat
from this builder.build
in class SortBuilder<FieldSortBuilder>
java.io.IOException
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getWriteableName()
NamedWriteable
public static FieldSortBuilder fromXContent(XContentParser parser, java.lang.String fieldName) throws java.io.IOException
parser
- the input parser. The state on the parser contained in this context will be changed as a side effect of this
method callfieldName
- in some sort syntax variations the field name precedes the xContent object that specifies further parameters, e.g.
in '{ "foo": { "order" : "asc"} }'. When parsing the inner object, the field name can be passed in via this argumentjava.io.IOException
public FieldSortBuilder rewrite(QueryRewriteContext ctx) throws java.io.IOException
Rewriteable
java.io.IOException