Skip to content

Commit 884e1c5

Browse files
committed
just as a safeguard original custom_mapping dict is left unchanged
1 parent a78cbdf commit 884e1c5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • integrations/elasticsearch/src/haystack_integrations/document_stores/elasticsearch

integrations/elasticsearch/src/haystack_integrations/document_stores/elasticsearch/document_store.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-FileCopyrightText: 2023-present deepset GmbH <info@deepset.ai>
22
#
33
# SPDX-License-Identifier: Apache-2.0
4-
4+
import copy
55
# ruff: noqa: FBT002, FBT001 boolean-type-hint-positional-argument and boolean-default-value-positional-argument
66
# ruff: noqa: B008 function-call-in-default-argument
77
# ruff: noqa: S101 disable checks for uses of the assert keyword
@@ -143,6 +143,7 @@ def __init__(
143143
raise ValueError(msg)
144144

145145
if self._custom_mapping and self._sparse_vector_field:
146+
self._custom_mapping = copy.deepcopy(custom_mapping) # original custom_mapping dict is left unchanged
146147
self._custom_mapping.setdefault("properties", {})
147148
self._custom_mapping["properties"][self._sparse_vector_field] = {"type": "sparse_vector"}
148149

0 commit comments

Comments
 (0)