Skip to content

Conversation

HyunSangHan
Copy link
Contributor

Summary

Introduces a new RemoveBlock API that complements the existing AddBlock API by allowing users to remove index blocks using DELETE /{index}/_block/{block}.

Resolves: #128966

Background

Currently, users add blocks via the AddBlock API (PUT /{index}/_block/{block}) but must remove them through the more generic Settings API (PUT /{index}/_settings).

What’s Changed

Core

  • Introduced new classes: RemoveIndexBlockRequest, RemoveIndexBlockResponse, TransportRemoveIndexBlockAction.
  • Added removeIndexBlock to MetadataIndexStateService.

REST API

  • New endpoint: DELETE /{index}/_block/{block}
  • Added new API spec: indices.remove_block.json
  • Response uses AcknowledgedResponse (no shard-level confirmation required)

Features

  • Integrated with security and operator privileges.
  • Safe to re-run (idempotent behavior).

Compatibility

  • Fully backward compatible
  • Existing Settings API remains unchanged
  • AddBlock API untouched

Testing

  • Unit tests for service logic
  • Integration tests covering full API usage and edge cases
  • REST YAML tests for endpoint validation
  • Security tests for permission checks
- Add RemoveIndexBlockRequest/Response/ClusterStateUpdateRequest classes - Add removeIndexBlock method to MetadataIndexStateService Provides core service infrastructure for removing index blocks.
- Add TransportRemoveIndexBlockAction and RemoveIndexBlockRequestBuilder - Add prepareRemoveBlock() and removeBlock() methods to IndicesAdminClient - Register RemoveBlock actions in ActionModule - Add integration tests and security permissions
- Add RestRemoveIndexBlockAction for DELETE /{index}/_block/{block} - Add indices.remove_block.json API specification - Update YAML REST tests and documentation - Remove shards_acknowledged field references from docs Completes public HTTP interface providing symmetry with addBlock API.
Copy link

cla-checker-service bot commented Jun 8, 2025

💚 CLA has been signed

@elasticsearchmachine elasticsearchmachine added v9.1.0 needs:triage Requires assignment of a team area label external-contributor Pull request authored by a developer outside the Elasticsearch team labels Jun 8, 2025
@HyunSangHan HyunSangHan closed this Jun 8, 2025
@HyunSangHan HyunSangHan reopened this Jun 8, 2025
@AI-IshanBhatt AI-IshanBhatt added the :Data Management/Indices APIs APIs to create and manage indices and templates label Jun 10, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Jun 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Jun 10, 2025
@nielsbauman nielsbauman self-assigned this Jun 10, 2025
@nielsbauman nielsbauman self-requested a review June 10, 2025 09:26
Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

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

Hi @HyunSangHan, thank you very much for your contribution to Elasticsearch! The PR is already looking good, I just have a few small comments for now - I need to have another look later on. I also pushed some changes myself, as they're hard to explain, but I didn't want to completely hijack your PR, so I'll let you take care of the remaining changes.

@nielsbauman
Copy link
Contributor

buildkite test this

Replace implicit default timeouts with explicit parameters in constructor to improve code clarity and follow established patterns.
@HyunSangHan HyunSangHan requested a review from nielsbauman June 11, 2025 15:10
Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

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

I just noticed I didn't actually push my commit last time, so I just did so. I added a few more comments. Thanks for incorporating my previous comments so soon!

@HyunSangHan
Copy link
Contributor Author

HyunSangHan commented Jun 15, 2025

@nielsbauman
After you trigger the build, most of the CI checks failed, even though I didn’t make any changes to those files in the failed one.
Could it be due to flaky tests, or is there something in my changes that might have caused it? 🤔

Copy link
Contributor

github-actions bot commented Jun 18, 2025

🔍 Preview links for changed docs:

🔔 The preview site may take up to 3 minutes to finish building. These links will become live once it completes.

@nielsbauman
Copy link
Contributor

buildkite test this

@nielsbauman
Copy link
Contributor

buildkite test this

Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

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

Hi @HyunSangHan, sorry for the late reply. I was discussing the changes with some colleagues who are more familiar with the inner workings of blocks. I added two more small comments, after that I think we're good to go.

- Add logic to MetadataIndexStateService.removeIndexBlock() to automatically clear VERIFIED_READ_ONLY_SETTING when no write-blocking constraints remain
@HyunSangHan HyunSangHan requested a review from nielsbauman June 24, 2025 16:57
@nielsbauman
Copy link
Contributor

buildkite test this

Copy link
Contributor

@nielsbauman nielsbauman left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you very much for your contribution and iterations on this PR, @HyunSangHan!

@nielsbauman nielsbauman enabled auto-merge (squash) June 24, 2025 18:44
@nielsbauman nielsbauman merged commit d16271b into elastic:main Jun 24, 2025
34 checks passed
@HyunSangHan
Copy link
Contributor Author

@nielsbauman
Thank you! 🙌 I really enjoyed working through the iterations and learned a lot from the process.
Appreciate all your feedback and support!

mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jun 25, 2025
…c#129128) Introduces a new `RemoveBlock` API that complements the existing `AddBlock` API by allowing users to remove index blocks using `DELETE /{index}/_block/{block}`. Resolves elastic#128966 --------- Co-authored-by: Niels Bauman <nielsbauman@gmail.com>
nielsbauman added a commit to elastic/elasticsearch-specification that referenced this pull request Jun 25, 2025
@injae-kim
Copy link

Awesome work @HyunSangHan !! 👏👏👏

@HyunSangHan
Copy link
Contributor Author

@nielsbauman
Hi, Niels!
I noticed that this feature is already reflected in the official documentation.
I've opened an issue to report it: #130242

@nielsbauman
Copy link
Contributor

Hi @HyunSangHan, thank you very much for addressing that and opening a new issue. I've asked someone from our docs team to have a look at what's going on there.

pquentin added a commit to elastic/elasticsearch-specification that referenced this pull request Jul 4, 2025
* Add index block removal API Follow-up of elastic/elasticsearch#129128 * Fix block enum * Add doc-id to table * Fix lint * Move IndicesBlockOptions and IndicesBlockStatus to indices/_types It's breaking but avoids duplicating the type names, which is forbidden. * Separate BlockStatus as it is different * Rename response example file * Fix response fields * Add index privilege --------- Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
github-actions bot pushed a commit to elastic/elasticsearch-specification that referenced this pull request Jul 4, 2025
* Add index block removal API Follow-up of elastic/elasticsearch#129128 * Fix block enum * Add doc-id to table * Fix lint * Move IndicesBlockOptions and IndicesBlockStatus to indices/_types It's breaking but avoids duplicating the type names, which is forbidden. * Separate BlockStatus as it is different * Rename response example file * Fix response fields * Add index privilege --------- Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co> (cherry picked from commit e668a98)
pquentin added a commit to elastic/elasticsearch-specification that referenced this pull request Jul 4, 2025
* Add index block removal API Follow-up of elastic/elasticsearch#129128 * Fix block enum * Add doc-id to table * Fix lint * Move IndicesBlockOptions and IndicesBlockStatus to indices/_types It's breaking but avoids duplicating the type names, which is forbidden. * Separate BlockStatus as it is different * Rename response example file * Fix response fields * Add index privilege --------- (cherry picked from commit e668a98) Co-authored-by: Niels Bauman <33722607+nielsbauman@users.noreply.github.com> Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
@HyunSangHan
Copy link
Contributor Author

We can find RemoveBlock API in the document after recent release:
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-remove-block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/Indices APIs APIs to create and manage indices and templates >enhancement external-contributor Pull request authored by a developer outside the Elasticsearch team Team:Data Management Meta label for data/management team v9.1.0

5 participants