https://github.com/ev2900/opensearch_read_only_index
Example covering how to set an OpenSearch index to read only. A common prerequisite for performance tuning tasks
https://github.com/ev2900/opensearch_read_only_index
aws opensearch read-only
Last synced: 11 months ago
JSON representation
Example covering how to set an OpenSearch index to read only. A common prerequisite for performance tuning tasks
- Host: GitHub
- URL: https://github.com/ev2900/opensearch_read_only_index
- Owner: ev2900
- Created: 2023-01-22T19:54:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-18T16:37:32.000Z (12 months ago)
- Last Synced: 2025-06-18T17:39:46.008Z (12 months ago)
- Topics: aws, opensearch, read-only
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OpenSearch Read Only Index

If you prefer to watch a video instead of reading the instructions below, check out the link below
YouTube video - https://youtu.be/45T49W9DHo4
## Overview
OpenSearch indices can be set to read only ie. all write requests will throw an exception and be blocked. There are multiple reasons why you would want to make an index read only. One reason is before running certain back end operations such as a force merge it is recommended to make an index read only.
The instructions below demonstrate how to make an index read only and the enable writes again.
## Set an Index to Read Only
Running
```
PUT sample-data/_settings
{
"index": {
"blocks.read_only": true
}
}
```
Will set the index **sample-data** to read only. After running the API call above if you try to write a document to the index you will receive an error

## Disable Read Only (ie. enable writes)
To re-enable writes or disable read only you can run the following API call
```
PUT sample-data/_settings
{
"index": {
"blocks.read_only": false
}
}
```
Once read only is false, you can again write data to the index