Class SliceBuilder

java.lang.Object
org.elasticsearch.search.slice.SliceBuilder
All Implemented Interfaces:
Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject

public class SliceBuilder extends Object implements Writeable, org.elasticsearch.common.xcontent.ToXContentObject
A slice builder allowing to split a scroll in multiple partitions. If the provided field is the "_uid" it uses a TermsSliceQuery 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 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.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.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 org.elasticsearch.common.xcontent.ParseField
     
    static org.elasticsearch.common.xcontent.ParseField
     
    static org.elasticsearch.common.xcontent.ParseField
     

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    SliceBuilder​(int id, int max)
    Build a slice using the default strategy.
    SliceBuilder​(String field, int id, int max)
    Build a slice on a particular field.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals​(Object o)
     
    fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser)
     
    The name of the field to slice against.
    int
    The id of the slice.
    int
    The maximum number of slices.
    int
     
    org.apache.lucene.search.Query
    Converts this QueryBuilder to a lucene Query.
     
    org.elasticsearch.common.xcontent.XContentBuilder
    toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
     
    void
    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 Details

    • FIELD_FIELD

      public static final org.elasticsearch.common.xcontent.ParseField FIELD_FIELD
    • ID_FIELD

      public static final org.elasticsearch.common.xcontent.ParseField ID_FIELD
    • MAX_FIELD

      public static final org.elasticsearch.common.xcontent.ParseField MAX_FIELD
  • Constructor Details

    • SliceBuilder

      public SliceBuilder(int id, int max)
      Build a slice using the default strategy.
      Parameters:
      id - The id of the slice
      max - The maximum number of slices
    • SliceBuilder

      public SliceBuilder(String field, int id, int max)
      Build a slice on a particular field.
      Parameters:
      field - The name of the field to slice against
      id - The id of the slice
      max - The maximum number of slices
    • SliceBuilder

      public SliceBuilder(StreamInput in) throws IOException
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • getField

      public String getField()
      The name of the field to slice against. If null, a default slicing strategy is used.
    • getId

      public int getId()
      The id of the slice.
    • getMax

      public int getMax()
      The maximum number of slices.
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      IOException
    • fromXContent

      public static SliceBuilder fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toFilter

      public org.apache.lucene.search.Query toFilter(ShardSearchRequest request, SearchExecutionContext context)
      Converts this QueryBuilder to a lucene Query.
      Parameters:
      context - Additional information needed to build the query
    • toString

      public String toString()
      Overrides:
      toString in class Object