From my understanding, nodes only can perform write operations on documents if they own their primary shard. Therefore if we have 2 nodes A
, B
and A
owns the primary shard of the doc D
, if the client asks node B
to modify document D
, node B
will route the requests to node A
which is the owner or D
's primary shard. Obviously it would be better for the client to directly request to the node which is owner the primary shard of a specific document to perform write operations. My question is that whether common Elasticsearch clients (Kibana, python, etc) try to utilize this fact to make their requests more performant?
No, I do not believe they do. Elasticsearch can relocate shards at any point so this would add a lot of complexity for little gain. A lot of the time indexing is also done through bulk requests, which could target multiple shards spread across the cluster where this type of request routing would not be beneficial.
Thanks for your reply. So the client can determine primary shard of the document but can not determine the node which has the shard, right?
The client does not care/know how many shards an index have or where they are located. This is handled by the node receiving the request. A client can send an index request to an index that does not yet exist and have it created automatically.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.