Class IndexLongFieldRange

org.elasticsearch.index.shard.IndexLongFieldRange
All Implemented Interfaces:
Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public class IndexLongFieldRange extends implements Writeable, org.elasticsearch.common.xcontent.ToXContentFragment
Class representing an (inclusive) range of long values in a field in an index which may comprise multiple shards. This information is accumulated shard-by-shard, and we keep track of which shards are represented in this value. Only once all shards are represented should this information be considered accurate for the index.
  • 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
    Sentinel value indicating an empty range, for instance because the field is missing or has no values in any shard.
    Sentinel value indicating that no information is currently available, for instance because the index has just been created.
    Sentinel value indicating the actual range is unknown, for instance because more docs may be added in future.

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

    EMPTY_PARAMS
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
     o)
     
    extendWithShardRange​(int shardId, int shardCount, ShardLongFieldRange shardFieldRange)
     
    fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser)
     
    long
     
    long
     
    int
     
    boolean
     
     
    removeShard​(int shardId, int numberOfShards)
    Remove the given shard from the set of known shards, possibly without adjusting the min and max.
     
    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.

    , , , , , , ,

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment

    isFragment
  • Field Details

    • NO_SHARDS

      public static final IndexLongFieldRange NO_SHARDS
      Sentinel value indicating that no information is currently available, for instance because the index has just been created.
    • EMPTY

      public static final IndexLongFieldRange EMPTY
      Sentinel value indicating an empty range, for instance because the field is missing or has no values in any shard.
    • UNKNOWN

      public static final IndexLongFieldRange UNKNOWN
      Sentinel value indicating the actual range is unknown, for instance because more docs may be added in future.
  • Method Details

    • isComplete

      public boolean isComplete()
      Returns:
      whether this range includes information from all shards yet.
    • containsAllShardRanges

      public boolean containsAllShardRanges()
      Returns:
      whether this range includes information from all shards and can be used meaningfully.
    • getMin

      public long getMin()
      Returns:
      the (inclusive) minimum of this range.
    • getMax

      public long getMax()
      Returns:
      the (inclusive) maximum of this range.
    • writeTo

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

      public static IndexLongFieldRange readFrom(StreamInput in) throws
      Throws:
    • toXContent

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

      public static IndexLongFieldRange fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws
      Throws:
    • extendWithShardRange

      public IndexLongFieldRange extendWithShardRange(int shardId, int shardCount, ShardLongFieldRange shardFieldRange)
    • toString

      public  toString()
      Overrides:
       in class 
    • equals

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

      public int hashCode()
      Overrides:
       in class 
    • removeShard

      public IndexLongFieldRange removeShard(int shardId, int numberOfShards)
      Remove the given shard from the set of known shards, possibly without adjusting the min and max. Used when allocating a stale primary which may have a different range from the original, so we must allow the range to grow. Note that this doesn't usually allow the range to shrink, so we may in theory hit this shard more than needed after allocating a stale primary.