Class IndexRouting


public abstract class IndexRouting extends Object
Generates the shard id for (id, routing) pairs.
  • Method Details

    • fromIndexMetadata

      public static IndexRouting fromIndexMetadata(IndexMetadata indexMetadata)
      Build the routing from IndexMetadata.
    • shardId

      public abstract int shardId(String id, @Nullable String routing)
      Generate the single shard id that should contain a document with the provided id and routing.
    • collectSearchShards

      public abstract void collectSearchShards(String routing, IntConsumer consumer)
      Collect all of the shard ids that *may* contain documents with the provided routing. Indices with a routing_partition will collect more than one shard. Indices without a partition will collect the same shard id as would be returned by shardId(java.lang.String, java.lang.String).
    • hashToShardId

      protected final int hashToShardId(int hash)
      Convert a hash generated from an (id, routing) pair into a shard id.