public class SliceBuilder extends ToXContentToBytes implements Writeable
TermsSliceQuery
to do the slicing. The slicing is done at the shard level first and then each shard is splitted in 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 of numShards*numSlices
).
Otherwise the provided field must be a numeric and doc_values must be enabled. In that case a
DocValuesSliceQuery
is used to filter the results.Writeable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static ParseField |
FIELD_FIELD |
static ParseField |
ID_FIELD |
static ParseField |
MAX_FIELD |
EMPTY_PARAMS
Constructor and Description |
---|
SliceBuilder(int id,
int max) |
SliceBuilder(StreamInput in) |
SliceBuilder(java.lang.String field,
int id,
int max) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
static SliceBuilder |
fromXContent(QueryParseContext context) |
java.lang.String |
getField()
The name of the field to slice against
|
int |
getId()
The id of the slice.
|
int |
getMax()
The maximum number of slices.
|
int |
hashCode() |
org.apache.lucene.search.Query |
toFilter(QueryShardContext context,
int shardId,
int numShards) |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
buildAsBytes, buildAsBytes, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
public static final ParseField FIELD_FIELD
public static final ParseField ID_FIELD
public static final ParseField MAX_FIELD
public SliceBuilder(int id, int max)
public SliceBuilder(java.lang.String field, int id, int max)
field
- The name of the fieldid
- The id of the slicemax
- The maximum number of slicespublic SliceBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
public java.lang.String getField()
public int getId()
public int getMax()
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent
in interface ToXContent
java.io.IOException
public static SliceBuilder fromXContent(QueryParseContext context) throws java.io.IOException
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 org.apache.lucene.search.Query toFilter(QueryShardContext context, int shardId, int numShards)