Package org.elasticsearch.search.slice
Class SliceBuilder
- java.lang.Object
-
- org.elasticsearch.search.slice.SliceBuilder
-
- All Implemented Interfaces:
Writeable
,ToXContent
,ToXContentObject
public class SliceBuilder extends java.lang.Object implements Writeable, ToXContentObject
A slice builder allowing to split a scroll in multiple partitions. If the provided field is the "_uid" it uses aTermsSliceQuery
to do the slicing. The slicing is done at the shard level first and then each shard is split into multiple slices. For instance if the number of shards is equal to 2 and the user requested 4 slices then the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard. This way the total number of bitsets that we need to build on each shard is bounded by the number of slices (instead ofnumShards*numSlices
). Otherwise the provided field must be a numeric and doc_values must be enabled. In that case aDocValuesSliceQuery
is used to filter the results.
-
-
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
FIELD_FIELD
static ParseField
ID_FIELD
static ParseField
MAX_FIELD
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description SliceBuilder(int id, int max)
SliceBuilder(java.lang.String field, int id, int max)
SliceBuilder(StreamInput in)
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object other)
static SliceBuilder
fromXContent(XContentParser parser)
java.lang.String
getField()
The name of the field to slice againstint
getId()
The id of the slice.int
getMax()
The maximum number of slices.int
hashCode()
org.apache.lucene.search.Query
toFilter(ClusterService clusterService, ShardSearchRequest request, QueryShardContext context, Version minNodeVersion)
Converts this QueryBuilder to a luceneQuery
.java.lang.String
toString()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
FIELD_FIELD
public static final ParseField FIELD_FIELD
-
ID_FIELD
public static final ParseField ID_FIELD
-
MAX_FIELD
public static final ParseField MAX_FIELD
-
-
Constructor Detail
-
SliceBuilder
public SliceBuilder(int id, int max)
-
SliceBuilder
public SliceBuilder(java.lang.String field, int id, int max)
- Parameters:
field
- The name of the fieldid
- The id of the slicemax
- The maximum number of slices
-
SliceBuilder
public SliceBuilder(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
getField
public java.lang.String getField()
The name of the field to slice against
-
getId
public int getId()
The id of the slice.
-
getMax
public int getMax()
The maximum number of slices.
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
fromXContent
public static SliceBuilder fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toFilter
public org.apache.lucene.search.Query toFilter(ClusterService clusterService, ShardSearchRequest request, QueryShardContext context, Version minNodeVersion)
Converts this QueryBuilder to a luceneQuery
.- Parameters:
context
- Additional information needed to build the query
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-