public class ScriptSortBuilder extends SortBuilder<ScriptSortBuilder>
| Modifier and Type | Class and Description |
|---|---|
static class |
ScriptSortBuilder.ScriptSortType |
Writeable.Reader<V>, Writeable.Writer<V>ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NAME |
static ParseField |
SCRIPT_FIELD |
static ParseField |
SORTMODE_FIELD |
static ParseField |
TYPE_FIELD |
NESTED_FILTER_FIELD, NESTED_PATH_FIELD, order, ORDER_FIELDEMPTY_PARAMS| Constructor and Description |
|---|
ScriptSortBuilder(Script script,
ScriptSortBuilder.ScriptSortType type)
Constructs a script sort builder with the given script.
|
ScriptSortBuilder(StreamInput in)
Read from a stream.
|
| Modifier and Type | Method and Description |
|---|---|
SortFieldAndFormat |
build(QueryShardContext context)
Create a @link
SortFieldAndFormat from this builder. |
boolean |
equals(java.lang.Object object) |
static ScriptSortBuilder |
fromXContent(QueryParseContext context,
java.lang.String elementName)
|
QueryBuilder |
getNestedFilter()
Gets the nested filter.
|
java.lang.String |
getNestedPath()
Gets the nested path.
|
java.lang.String |
getWriteableName()
Returns the name of the writeable object
|
int |
hashCode() |
Script |
script()
Get the script used in this sort.
|
ScriptSortBuilder |
setNestedFilter(QueryBuilder nestedFilter)
Sets the nested filter that the nested objects should match with in order to be taken into account
for sorting.
|
ScriptSortBuilder |
setNestedPath(java.lang.String nestedPath)
Sets the nested path if sorting occurs on a field that is inside a nested object.
|
SortMode |
sortMode()
Get the sort mode.
|
ScriptSortBuilder |
sortMode(SortMode sortMode)
Defines which distance to use for sorting in the case a document contains multiple values.
For ScriptSortBuilder.ScriptSortType.STRING, the set of possible values is restricted to SortMode.MIN and SortMode.MAX |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params builderParams) |
ScriptSortBuilder.ScriptSortType |
type()
Get the type used in this sort.
|
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
buildSort, fromXContent, order, order, parseNestedFilter, resolveNestedbuildAsBytes, buildAsBytes, toString, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitisFragmentpublic static final java.lang.String NAME
public static final ParseField TYPE_FIELD
public static final ParseField SCRIPT_FIELD
public static final ParseField SORTMODE_FIELD
public ScriptSortBuilder(Script script, ScriptSortBuilder.ScriptSortType type)
script - The script to use.type - The type of the script, can be either ScriptSortBuilder.ScriptSortType.STRING or
ScriptSortBuilder.ScriptSortType.NUMBERpublic ScriptSortBuilder(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic void writeTo(StreamOutput out) throws java.io.IOException
Writeablejava.io.IOExceptionpublic Script script()
public ScriptSortBuilder.ScriptSortType type()
public ScriptSortBuilder sortMode(SortMode sortMode)
ScriptSortBuilder.ScriptSortType.STRING, the set of possible values is restricted to SortMode.MIN and SortMode.MAXpublic SortMode sortMode()
public ScriptSortBuilder setNestedFilter(QueryBuilder nestedFilter)
public QueryBuilder getNestedFilter()
public ScriptSortBuilder setNestedPath(java.lang.String nestedPath)
public java.lang.String getNestedPath()
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params builderParams) throws java.io.IOException
java.io.IOExceptionpublic static ScriptSortBuilder fromXContent(QueryParseContext context, java.lang.String elementName) throws java.io.IOException
context - the input parse context. The state on the parser contained in this context will be changed as a side effect of this
method callelementName - 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.IOExceptionpublic SortFieldAndFormat build(QueryShardContext context) throws java.io.IOException
SortBuilderSortFieldAndFormat from this builder.build in class SortBuilder<ScriptSortBuilder>java.io.IOExceptionpublic boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String getWriteableName()
NamedWriteable