Class IndexRouting.ExtractFromSource

java.lang.Object
org.elasticsearch.cluster.routing.IndexRouting
org.elasticsearch.cluster.routing.IndexRouting.ExtractFromSource
Direct Known Subclasses:
IndexRouting.ExtractFromSource.ForIndexDimensions, IndexRouting.ExtractFromSource.ForRoutingPath
Enclosing class:
IndexRouting

public abstract static class IndexRouting.ExtractFromSource extends IndexRouting
Base class for strategies that determine the shard by extracting and hashing fields from the document source.
  • Field Details

  • Method Details

    • postProcess

      public void postProcess(IndexRequest indexRequest)
      Description copied from class: IndexRouting
      Finalize the request after routing, incorporating data produced by the routing logic.
      Overrides:
      postProcess in class IndexRouting
    • indexShard

      public int indexShard(IndexRequest indexRequest)
      Description copied from class: IndexRouting
      Called when indexing a document to generate the shard id that should contain a document with the provided parameters.
      Specified by:
      indexShard in class IndexRouting
    • hashSource

      protected abstract int hashSource(IndexRequest indexRequest)
    • hash

      protected static int hash(org.apache.lucene.util.BytesRef ref)
    • updateShard

      public int updateShard(String id, @Nullable String routing)
      Description copied from class: IndexRouting
      Called when updating a document to generate the shard id that should contain a document with the provided _id and (optional) _routing.
      Specified by:
      updateShard in class IndexRouting
    • deleteShard

      public int deleteShard(String id, @Nullable String routing)
      Description copied from class: IndexRouting
      Called when deleting a document to generate the shard id that should contain a document with the provided _id and (optional) _routing.
      Specified by:
      deleteShard in class IndexRouting
    • getShard

      public int getShard(String id, @Nullable String routing)
      Description copied from class: IndexRouting
      Called when getting a document to generate the shard id that should contain a document with the provided _id and (optional) _routing.
      Specified by:
      getShard in class IndexRouting
    • checkIndexSplitAllowed

      public void checkIndexSplitAllowed()
      Description copied from class: IndexRouting
      Check if the _split index operation is allowed for an index
      Overrides:
      checkIndexSplitAllowed in class IndexRouting
    • collectSearchShards

      public void collectSearchShards(String routing, IntConsumer consumer)
      Description copied from class: IndexRouting
      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 IndexRouting.getShard(java.lang.String, java.lang.String).

      Note: This is called for any search-like requests that have a routing specified but only if they have a routing specified. If they do not have a routing they just use all shards in the index.

      Specified by:
      collectSearchShards in class IndexRouting