Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Removed
### Fixed
- Moved client tests to dedicated files to ensure they are run ([944](https://github.com/opensearch-project/opensearch-py/pull/944))
- Fix `Index.is_closed` not passing through aliases to the underlying index, preventing saving ([941](https://github.com/opensearch-project/opensearch-py/pull/941))

### Security
### Dependencies
- Bumps `aiohttp` from >=3.9.4,<4 to >=3.10.11,<4 ([#920](https://github.com/opensearch-project/opensearch-py/pull/920))
Expand Down
7 changes: 6 additions & 1 deletion opensearchpy/_async/helpers/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,12 @@ async def is_closed(self, using: Any = None) -> Any:
state = await (await self._get_connection(using)).cluster.state(
index=self._name, metric="metadata"
)
return state["metadata"]["indices"][self._name]["state"] == "close"
index_name = (
next(iter(state["metadata"]["indices"].keys()))
if len(state["metadata"]["indices"].keys()) == 1
else self._name
)
return state["metadata"]["indices"][index_name]["state"] == "close"

async def save(self, using: Any = None) -> Any:
"""
Expand Down
7 changes: 6 additions & 1 deletion opensearchpy/helpers/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,12 @@ def is_closed(self, using: Optional[OpenSearch] = None) -> Any:
state = self._get_connection(using).cluster.state(
index=self._name, metric="metadata"
)
return state["metadata"]["indices"][self._name]["state"] == "close"
index_name = (
next(iter(state["metadata"]["indices"].keys()))
if len(state["metadata"]["indices"].keys()) == 1
else self._name
)
return state["metadata"]["indices"][index_name]["state"] == "close"

def save(self, using: Optional[OpenSearch] = None) -> Any:
"""
Expand Down
Loading