Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tstadel committed Jun 21, 2024
1 parent f991d5f commit 2810eaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,15 @@ def client(self) -> OpenSearch:
elif self._create_index:
# Create the index if it doesn't exist
body = {"mappings": self._mappings, "settings": self._settings}
self._client.indices.create(index=self._index, body=body)
self._client.indices.create(index=self._index, body=body) # type:ignore
return self._client

def create_index(self, index: Optional[str] = None, mappings: Optional[Dict[str, Any]] = None, settings: Optional[Dict[str, Any]] = None) -> None:

def create_index(
self,
index: Optional[str] = None,
mappings: Optional[Dict[str, Any]] = None,
settings: Optional[Dict[str, Any]] = None,
) -> None:
"""
Creates an index in OpenSearch.
Expand All @@ -141,7 +146,7 @@ def create_index(self, index: Optional[str] = None, mappings: Optional[Dict[str,
mappings = self._mappings
if not settings:
settings = self._settings

if not self.client.indices.exists(index=index):
self.client.indices.create(index=index, body={"mappings": mappings, "settings": settings})

Expand Down
2 changes: 1 addition & 1 deletion integrations/opensearch/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_write_documents_readonly(self, document_store_readonly: OpenSearchDocum

def test_create_index(self, document_store_readonly: OpenSearchDocumentStore):
document_store_readonly.create_index()
assert document_store_readonly.client.indices.exists(index=document_store_readonly.index)
assert document_store_readonly.client.indices.exists(index=document_store_readonly._index)

def test_bm25_retrieval(self, document_store: OpenSearchDocumentStore):
document_store.write_documents(
Expand Down

0 comments on commit 2810eaa

Please sign in to comment.