Skip to content

Commit

Permalink
chore: ElasticSearch - remove legacy filters elasticsearch (#1078)
Browse files Browse the repository at this point in the history
* Remove legacy filter support

* Improve error message

* Error msg fmt
  • Loading branch information
vblagoje authored Sep 12, 2024
1 parent 4f19d57 commit 3d2693d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from haystack.dataclasses import Document
from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
from haystack.document_stores.types import DuplicatePolicy
from haystack.utils.filters import convert
from haystack.version import __version__ as haystack_version

from elasticsearch import Elasticsearch, helpers # type: ignore[import-not-found]
Expand Down Expand Up @@ -224,7 +223,8 @@ def filter_documents(self, filters: Optional[Dict[str, Any]] = None) -> List[Doc
:returns: List of `Document`s that match the filters.
"""
if filters and "operator" not in filters and "conditions" not in filters:
filters = convert(filters)
msg = "Invalid filter syntax. See https://docs.haystack.deepset.ai/docs/metadata-filtering for details."
raise ValueError(msg)

query = {"bool": {"filter": _normalize_filters(filters)}} if filters else None
documents = self._search_documents(query=query)
Expand Down

0 comments on commit 3d2693d

Please sign in to comment.