[BUG] GET {index}/_settings does not list number_of_routing_shards as setting
Describe the bug
Number of routing shards is a user definable setting which is used during splitting of shard to determine valid splits and number of splits possible. The setting itself is persisted in the IndexMetadata.
Although, we can get the value from _cluster/state under the index's metadata as routing_num_shards field, but, it isn't listed while calling GET {index}/_settings. Naturally, users expect it to be present in the output of GET {index}/_settings.
Related component
Indexing
To Reproduce
Click to see detailed steps:
Checkout 4c25257 from opensearch:main.
# create index
http PUT :9200/sample-idx 'settings:={"number_of_replicas":1, "number_of_shards": 1, "number_of_routing_shards": 512}'
HTTP/1.1 200 OK
X-OpenSearch-Version: OpenSearch/3.0.0-SNAPSHOT (opensearch)
content-encoding: gzip
content-length: 77
content-type: application/json; charset=UTF-8
{
"acknowledged": true,
"index": "sample-idx",
"shards_acknowledged": true
}
# get index settings
http :9200/sample-idx/_settings
HTTP/1.1 200 OK
X-OpenSearch-Version: OpenSearch/3.0.0-SNAPSHOT (opensearch)
content-encoding: gzip
content-length: 203
content-type: application/json; charset=UTF-8
{
"sample-idx": {
"settings": {
"index": {
"creation_date": "1718143398625",
"number_of_replicas": "1",
"number_of_shards": "1",
"provided_name": "sample-idx", <-- not listed in {index}/_settings
"replication": {
"type": "DOCUMENT"
},
"uuid": "KOvdS229RXS7FeQ2ltLJ6g",
"version": {
"created": "137217827"
}
}
}
}
}
# get cluster state
http :9200/_cluster/state
HTTP/1.1 200 OK
X-OpenSearch-Version: OpenSearch/3.0.0-SNAPSHOT (opensearch)
content-encoding: gzip
content-length: 876
content-type: application/json; charset=UTF-8
{
"blocks": {},
"cluster_manager_node": "fBwVW6GOQUCG4ZtiV2kJqw",
"cluster_name": "runTask",
"cluster_uuid": "N14cN9NDSOqNuiwuq7uQNQ",
"master_node": "fBwVW6GOQUCG4ZtiV2kJqw",
"metadata": {
"cluster_coordination": {
... snip ...
"indices": {
"sample-idx": {
"aliases": [],
"aliases_version": 1,
"in_sync_allocations": {
"0": [
"ONEQ3Wc2RAOtb6h4c74Nag"
]
},
"mapping_version": 1,
"mappings": {},
"primary_terms": {
"0": 1
},
"rollover_info": {},
"routing_num_shards": 512, <-- visible here
... snip ...
Expected behavior
User should not delve into the _cluster/state to figure out routing_num_shards information. Instead index.routing_number_of_shards should be listed in the {index}/_settings response.
Additional Details
Plugins
N/A
Screenshots
N/A
Host/Environment (please complete the following information):
- OS: MacOS Sonoma
Additional context
N/A
Hello, do you mind if I take a stab at this issue?
Go ahead! @PeacefulTortoise. I don't see anyone working on it. I've assigned to you.
I've put up an initial PR! I'm not sure if that line of code that I removed was intentionally put there or not. Could you let me know if this fix looks good?
is this bug closed?
Hi, @srikanthpadakanti I don't think any PR related to the issue was merged. You can see the steps to reproduce the bug.
Feel free to pick it up if you are interested :)