Skip to content

Commit

Permalink
Refresh Opensearch index after delete operation (run-llama#15854)
Browse files Browse the repository at this point in the history
  • Loading branch information
spreeni authored and raspawar committed Oct 7, 2024
1 parent 9a95d6f commit 1523371
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG — llama-index-vector-stores-opensearch

## [0.2.1]

- Refresh Opensearch index after delete operation to reflect the change for future searches

## [0.1.14]

- Adds support for full MetadataFilters (all operators and nested filters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ async def delete_by_doc_id(self, doc_id: str) -> None:
search_query = {
"query": {"term": {"metadata.doc_id.keyword": {"value": doc_id}}}
}
await self._os_client.delete_by_query(index=self._index, body=search_query)
await self._os_client.delete_by_query(
index=self._index, body=search_query, refresh=True
)

async def delete_nodes(
self,
Expand All @@ -490,12 +492,16 @@ async def delete_nodes(
if filters:
query["query"]["bool"]["filter"].extend(self._parse_filters(filters))

await self._os_client.delete_by_query(index=self._index, body=query)
await self._os_client.delete_by_query(
index=self._index, body=query, refresh=True
)

async def clear(self) -> None:
"""Clears index."""
query = {"query": {"bool": {"filter": []}}}
await self._os_client.delete_by_query(index=self._index, body=query)
await self._os_client.delete_by_query(
index=self._index, body=query, refresh=True
)

async def aquery(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-vector-stores-opensearch"
readme = "README.md"
version = "0.2.0"
version = "0.2.1"

[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
Expand Down

0 comments on commit 1523371

Please sign in to comment.