opensearch-project/OpenSearch
在 GitHub 查看[BUG] Resize request should throw 4xx as part of validation failure for write block
Open
#19,026 建立於 2025年8月11日
Cluster Managerbuggood first issue
描述
Describe the bug
Currently as part of the resize request validation while creating a target index using MetadataCreateIndexService, it throws IllegalStateException that gets translated to 5xx. Here it should instead throw IllegalArgumentException which will be translated to 4xx. 5xx is usually treated as server side failure/error whereas 4xx will be wrong user input which fits well in this case.
Response:
HTTP/2 500 Internal Server Error
Date: Mon, 07 Jul 2025 15:48:17 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 315
Access-Control-Allow-Origin: *
{"error":{"root_cause":[{"type":"illegal_state_exception","reason":"index test-01 must block write operations to resize index. use \"index.blocks.write=true\""}],"type":"illegal_state_exception","reason":"index test-01 must block write operations to resize index. use \"index.blocks.write=true\""},"status":500}
Related component
No response
To Reproduce
- Submit request to shrink an existing index (test-01) without write block on it.
curl localhost:9200/test-01/_shrink/test-shrink-01
Expected behavior
OpenSearch should throw 4xx error instead of 5xx
Additional Details
N/A