java.lang.Object
org.elasticsearch.cluster.routing.IndexRouting
- Direct Known Subclasses:
IndexRouting.ExtractFromSource
Generates the shard id for
(id, routing) pairs.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidCheck if the _split index operation is allowed for an indexabstract voidcollectSearchShards(String routing, IntConsumer consumer) Collect all of the shard ids that *may* contain documents with the providedrouting.abstract intdeleteShard(String id, String routing) Called when deleting a document to generate the shard id that should contain a document with the provided_idand (optional)_routing.static IndexRoutingfromIndexMetadata(IndexMetadata metadata) Build the routing fromIndexMetadata.abstract intCalled when getting a document to generate the shard id that should contain a document with the provided_idand (optional)_routing.protected final inthashToShardId(int hash) Convert a hash generated from an(id, routing) pair into a shard id.abstract intindexShard(String id, String routing, XContentType sourceType, BytesReference source) Called when indexing a document to generate the shard id that should contain a document with the provided parameters.abstract voidprocess(IndexRequest indexRequest) abstract intupdateShard(String id, String routing) Called when updating a document to generate the shard id that should contain a document with the provided_idand (optional)_routing.
-
Field Details
-
indexName
-
-
Method Details
-
fromIndexMetadata
Build the routing fromIndexMetadata. -
process
-
indexShard
public abstract int indexShard(String id, @Nullable String routing, XContentType sourceType, BytesReference source) Called when indexing a document to generate the shard id that should contain a document with the provided parameters. -
updateShard
Called when updating a document to generate the shard id that should contain a document with the provided_idand (optional)_routing. -
deleteShard
Called when deleting a document to generate the shard id that should contain a document with the provided_idand (optional)_routing. -
getShard
Called when getting a document to generate the shard id that should contain a document with the provided_idand (optional)_routing. -
collectSearchShards
Collect all of the shard ids that *may* contain documents with the providedrouting. Indices with arouting_partitionwill collect more than one shard. Indices without a partition will collect the same shard id as would be returned bygetShard(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.
-
hashToShardId
protected final int hashToShardId(int hash) Convert a hash generated from an(id, routing) pair into a shard id. -
checkIndexSplitAllowed
public void checkIndexSplitAllowed()Check if the _split index operation is allowed for an index- Throws:
IllegalArgumentException- if the operation is not allowed
-