Skip to content

Use the a mod number of shard function to route#137062

Merged
Tim-Brooks merged 46 commits intoelastic:mainfrom
Tim-Brooks:routing_function_number_of_shards
Jan 13, 2026
Merged

Use the a mod number of shard function to route#137062
Tim-Brooks merged 46 commits intoelastic:mainfrom
Tim-Brooks:routing_function_number_of_shards

Conversation

@Tim-Brooks
Copy link
Contributor

Using hash % number of shards to routing documents.

@Tim-Brooks Tim-Brooks added >non-issue :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. v9.3.0 labels Oct 23, 2025
@Tim-Brooks
Copy link
Contributor Author

Work in progress.

@github-actions
Copy link
Contributor

ℹ️ Important: Docs version tagging

👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.

We use applies_to tags to mark version-specific features and changes.

Expand for a quick overview

When to use applies_to tags:

✅ At the page level to indicate which products/deployments the content applies to (mandatory)
✅ When features change state (e.g. preview, ga) in a specific version
✅ When availability differs across deployments and environments

What NOT to do:

❌ Don't remove or replace information that applies to an older version
❌ Don't add new information that applies to a specific version without an applies_to tag
❌ Don't forget that applies_to tags can be used at the page, section, and inline level

🤔 Need help?

@Tim-Brooks Tim-Brooks requested a review from lkts December 18, 2025 05:50
@Tim-Brooks
Copy link
Contributor Author

I'm going to figure out how to mute that rest compat test which is tightly coupled to shard number tomorrow.

Copy link
Contributor

@lkts lkts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The routing piece looks good to me.

We'll need to change the documentation once this is merged.

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I left a few detailed comments.

Additionally, I wonder if we need a minimal unit test of old and new index-routing behavior.

@Tim-Brooks
Copy link
Contributor Author

This is ready for another review @henningandersen. I'm opening a rest api test fix on 8.x to fix the BWC test.

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

jxie-1 added a commit to jxie-1/elasticsearch that referenced this pull request Jan 8, 2026
jxie-1 added a commit to jxie-1/elasticsearch that referenced this pull request Jan 9, 2026
@Tim-Brooks Tim-Brooks merged commit ab74583 into elastic:main Jan 13, 2026
35 checks passed
eranweiss-elastic pushed a commit to eranweiss-elastic/elasticsearch that referenced this pull request Jan 15, 2026
Using hash % number of shards to routing documents. This commit
introduces an index version to indicate which routing function
an index is using. Since traditional split, clone, and shrink
functions inherit index version this means that documents will
still be routed the same after the shard is resized.
spinscale pushed a commit to spinscale/elasticsearch that referenced this pull request Jan 21, 2026
Using hash % number of shards to routing documents. This commit
introduces an index version to indicate which routing function
an index is using. Since traditional split, clone, and shrink
functions inherit index version this means that documents will
still be routed the same after the shard is resized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>breaking :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >non-issue Team:Distributed Indexing (obsolete) Meta label for Distributed Indexing team. Obsolete. Please do not use. v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants