From 1e1a232266c570a34f934a2d4f6762004f2bb9a5 Mon Sep 17 00:00:00 2001 From: Logan Markewich Date: Thu, 27 Jun 2024 14:27:57 -0700 Subject: [PATCH] nits --- .../vector_stores/elasticsearch/base.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/llama-index-integrations/vector_stores/llama-index-vector-stores-elasticsearch/llama_index/vector_stores/elasticsearch/base.py b/llama-index-integrations/vector_stores/llama-index-vector-stores-elasticsearch/llama_index/vector_stores/elasticsearch/base.py index 2388365b8e836..ab388ecc2a164 100644 --- a/llama-index-integrations/vector_stores/llama-index-vector-stores-elasticsearch/llama_index/vector_stores/elasticsearch/base.py +++ b/llama-index-integrations/vector_stores/llama-index-vector-stores-elasticsearch/llama_index/vector_stores/elasticsearch/base.py @@ -215,7 +215,8 @@ def __init__( batch_size: int = 200, distance_strategy: Optional[DISTANCE_STRATEGIES] = "COSINE", retrieval_strategy: Optional[AsyncRetrievalStrategy] = None, - **kwargs + metadata_mappings: Optional[Dict[str, Dict[str, str]]] = None, + **kwargs, ) -> None: nest_asyncio.apply() @@ -239,10 +240,9 @@ def __init__( "ref_doc_id": {"type": "keyword"}, } - metadata_mappings = kwargs.pop('metadata_mappings', None) - if metadata_mappings: - base_metadata_mappings.update(metadata_mappings) - + if metadata_mappings is not None: + metadata_mappings.update(base_metadata_mappings) + self._store = AsyncVectorStore( user_agent=get_user_agent(), client=es_client, @@ -301,7 +301,11 @@ def add( BulkIndexError: If AsyncElasticsearch async_bulk indexing fails. """ return asyncio.get_event_loop().run_until_complete( - self.async_add(nodes, create_index_if_not_exists=create_index_if_not_exists, **add_kwargs) + self.async_add( + nodes, + create_index_if_not_exists=create_index_if_not_exists, + **add_kwargs, + ) ) async def async_add(