NamedWriteable
, Writeable
, ToXContent
, ToXContentObject
, Rewriteable<SortBuilder<?>>
public class ScriptSortBuilder extends SortBuilder<ScriptSortBuilder>
Modifier and Type | Class | Description |
---|---|---|
static class |
ScriptSortBuilder.ScriptSortType |
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
NAME |
|
static ParseField |
SCRIPT_FIELD |
|
static ParseField |
SORTMODE_FIELD |
|
static ParseField |
TYPE_FIELD |
MAX_REWRITE_ROUNDS
NESTED_FILTER_FIELD, NESTED_PATH_FIELD, order, ORDER_FIELD
EMPTY_PARAMS
Constructor | Description |
---|---|
ScriptSortBuilder(StreamInput in) |
Read from a stream.
|
ScriptSortBuilder(Script script,
ScriptSortBuilder.ScriptSortType type) |
Constructs a script sort builder with the given script.
|
Modifier and Type | Method | Description |
---|---|---|
SortFieldAndFormat |
build(QueryShardContext context) |
Create a @link
SortFieldAndFormat from this builder. |
boolean |
equals(java.lang.Object object) |
|
static ScriptSortBuilder |
fromXContent(XContentParser parser,
java.lang.String elementName) |
|
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() |
|
ScriptSortBuilder |
rewrite(QueryRewriteContext ctx) |
Rewrites this instance based on the provided context.
|
Script |
script() |
Get the script used in this sort.
|
ScriptSortBuilder |
setNestedFilter(QueryBuilder nestedFilter) |
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder) and retrieve with getNestedSort() |
ScriptSortBuilder |
setNestedPath(java.lang.String nestedPath) |
Deprecated.
set nested sort with
setNestedSort(NestedSortBuilder) and retrieve with getNestedSort() |
ScriptSortBuilder |
setNestedSort(NestedSortBuilder nestedSort) |
Sets the
NestedSortBuilder to be used for fields that are 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.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
buildSort, fromXContent, order, order, parseNestedFilter, resolveNested, resolveNested, toString
isFragment
public 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.NUMBER
public ScriptSortBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
java.io.IOException
public 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.MAX
public SortMode sortMode()
@Deprecated public ScriptSortBuilder setNestedFilter(QueryBuilder nestedFilter)
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
@Deprecated public QueryBuilder getNestedFilter()
setNestedSort(NestedSortBuilder)
and retrieve with getNestedSort()
@Deprecated public ScriptSortBuilder 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 ScriptSortBuilder 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 builderParams) throws java.io.IOException
java.io.IOException
public static ScriptSortBuilder fromXContent(XContentParser parser, java.lang.String elementName)
parser
- the input parser. 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 argumentpublic SortFieldAndFormat build(QueryShardContext context) throws java.io.IOException
SortBuilder
SortFieldAndFormat
from this builder.build
in class SortBuilder<ScriptSortBuilder>
java.io.IOException
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getWriteableName()
NamedWriteable
public ScriptSortBuilder rewrite(QueryRewriteContext ctx) throws java.io.IOException
Rewriteable
java.io.IOException