opensearch-project / opensearch-project/opensearch-java

[BUG] Unable to set/unset index blocks to read_only

Open
#871 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
165
Forks
250
Avg merge
1d 18h
Merged PRs (30d)
26

Description

I am using opensearch-java-2.8.0 and trying to set the index block to read_only using the below code.

PutIndicesSettingsResponse response = elasticSearchIndicesClient.putSettings(b->b.index(index)
                .settings(s->s.blocksReadOnly(true)));

and then trying to unset it by passing false

I get the below error while unsetting it.

org.opensearch.client.opensearch._types.OpenSearchException: Request failed: [cluster_block_exception] index ["some_index"] blocked by: [FORBIDDEN/5/index read-only (api)];

Please let me know the correct way to set it and you can close this if this is not a issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the PutIndicesSettings request shown in the issue, testing both blocksReadOnly(true) and false against the index settings API. Inspect the resulting request and cluster_block_exception response to determine whether the behavior is in the Java client or the OpenSearch API; done means documenting the supported way to set and unset the block.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.