Skip to content

[BUG] Different behavior when the setting index.number_of_routing_shards is set to null or not set. #16327

@gaobinlong

Description

@gaobinlong

Describe the bug

The index level setting index.number_of_routing_shards can be set at the index creation time, but if it is set to null explicitly, the value is different from the value when it's not set.

Related component

Indexing

To Reproduce

  1. Set to null
DELETE abc

PUT abc
{
  "settings": {
    "index.number_of_routing_shards":null,
    "index.number_of_shards":"2"
  }
}

GET _cluster/state/metadata/abc

, we can see routing_num_shards is 2, equals to the number_of_shards, but not correct because we cannot split the index anymore.

  1. Not set
DELETE abc

PUT abc
{
  "settings": {
    "index.number_of_shards":"2"
  }
}

GET _cluster/state/metadata/abc

we can see routing_num_shards is 1024, this value is correct.

Expected behavior

When the setting is set to null, the value of routing_num_shards should be same to the value when it's not set.

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [MacOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingIndexing, Bulk Indexing and anything related to indexingbugSomething isn't workingv2.18.0Issues and PRs related to version 2.18.0v3.0.0Issues and PRs related to version 3.0.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions