Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
2cf4f96
adding methods based on OpenSearch implementation
davidsbatista Jan 7, 2026
12314e6
adding methods based on OpenSearch implementation + initial tests
davidsbatista Jan 7, 2026
fd1ebe0
Merge branch 'main' into feat/add-count-filtering-to-ElasticSearchDoc…
davidsbatista Jan 7, 2026
7c090da
removing unecessarty compreenshion
davidsbatista Jan 7, 2026
84cb394
Merge branch 'main' into feat/add-count-filtering-to-ElasticSearchDoc…
davidsbatista Jan 9, 2026
c752b95
cleaning up
davidsbatista Jan 9, 2026
b3b79f7
Merge branch 'main' into feat/add-count-filtering-to-ElasticSearchDoc…
davidsbatista Jan 9, 2026
0306ad5
updating tests
davidsbatista Jan 9, 2026
42025d9
Merge branch 'main' into feat/add-count-filtering-to-ElasticSearchDoc…
davidsbatista Jan 9, 2026
f1bb822
cleaning up
davidsbatista Jan 9, 2026
29a99fc
reducing duplicated code
davidsbatista Jan 9, 2026
f514842
Merge branch 'main' into feat/add-count-filtering-to-ElasticSearchDoc…
davidsbatista Jan 9, 2026
48c6871
Merge branch 'main' into feat/add-count-filtering-to-ElasticSearchDoc…
davidsbatista Jan 12, 2026
867c55b
Merge branch 'main' into feat/add-count-filtering-to-ElasticSearchDoc…
davidsbatista Jan 12, 2026
6c3cfc5
Merge branch 'main' into feat/add-count-filtering-to-ElasticSearchDoc…
davidsbatista Jan 12, 2026
c964d84
fixed metadata merging to properly update the meta key
davidsbatista Jan 13, 2026
4b8df62
formmatting
davidsbatista Jan 13, 2026
d5dfebb
adding count distinct metadata values
davidsbatista Jan 13, 2026
e377af8
refactoring to reduce duplicated code
davidsbatista Jan 5, 2026
e9e42d1
adding get metadata info
davidsbatista Jan 5, 2026
6b5b798
adding get_field_max_min
davidsbatista Jan 5, 2026
db2627e
fixing get_field_max_min
davidsbatista Jan 5, 2026
bbfe5a2
adding get_field_unique_values
davidsbatista Jan 5, 2026
870383d
adding get_field_unique_values async
davidsbatista Jan 5, 2026
a3571c3
formmatting
davidsbatista Jan 5, 2026
3ab82be
updating tests
davidsbatista Jan 13, 2026
d136fd0
formmatting
davidsbatista Jan 5, 2026
419678b
cleaning up
davidsbatista Jan 6, 2026
410c4fa
adding httpx as a dependency
davidsbatista Jan 6, 2026
df469f4
fixing pyproject.toml
davidsbatista Jan 6, 2026
92940af
updating tests: making use of the new refresh feature
davidsbatista Jan 7, 2026
77ef07e
dealing with special fields
davidsbatista Jan 8, 2026
697f4ca
docstring update
davidsbatista Jan 8, 2026
946d6b3
adding roundtrip tests to assert documents metadata is correctly writ…
davidsbatista Jan 8, 2026
af32dbd
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
998cedd
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
4b2f84e
updating function names
davidsbatista Jan 13, 2026
825bb14
updating function names + tests
davidsbatista Jan 13, 2026
b19f7fd
chore!: hanlp - drop Python 3.9 and use X|Y typing (#2707)
anakin87 Jan 12, 2026
7a4e80a
Update the changelog
HaystackBot Jan 12, 2026
0734e97
chore!: jina - drop Python 3.9 and use X|Y typing (#2708)
anakin87 Jan 12, 2026
9ccca00
Update the changelog
HaystackBot Jan 12, 2026
2c9555c
chore!: langfuse - drop Python 3.9 and use X|Y typing (#2709)
anakin87 Jan 12, 2026
1d0fbd6
Update the changelog
HaystackBot Jan 12, 2026
ec57802
chore!: github - drop Python 3.9 and use X|Y typing (#2705)
anakin87 Jan 12, 2026
482fbd6
Update the changelog
HaystackBot Jan 12, 2026
de4e7b9
chore!: google_genai - drop Python 3.9 and use X|Y typing (#2706)
anakin87 Jan 12, 2026
1c32e8f
Update the changelog
HaystackBot Jan 12, 2026
da4497d
chore!: paddleocr - drop Python 3.9 and use X|Y typing (#2714)
anakin87 Jan 12, 2026
44fa3e6
Update the changelog
HaystackBot Jan 12, 2026
b9e9373
chore: pin llama-stack; X|Y typing (#2715)
anakin87 Jan 12, 2026
6f6a9ba
Update the changelog
HaystackBot Jan 12, 2026
389d7fd
chore!: llama_cpp - drop Python 3.9 and use X|Y typing (#2710)
anakin87 Jan 12, 2026
16c64d4
Update the changelog
HaystackBot Jan 12, 2026
6ab1f04
chore!: meta_llama - drop Python 3.9 and use X|Y typing (#2712)
anakin87 Jan 12, 2026
a9d9614
Update the changelog
HaystackBot Jan 12, 2026
15d8d4e
chore!: mistral - drop Python 3.9 and use X|Y typing (#2716)
anakin87 Jan 12, 2026
149af5f
Update the changelog
HaystackBot Jan 12, 2026
29583dd
chore!: mongodb_atlas - drop Python 3.9 and use X|Y typing (#2718)
anakin87 Jan 12, 2026
3a8234f
Update the changelog
HaystackBot Jan 12, 2026
c66a3b6
chore!: pgvector - drop Python 3.9 and use X|Y typing (#2722)
anakin87 Jan 12, 2026
dda61f6
Update the changelog
HaystackBot Jan 12, 2026
86c32ca
chore!: ollama - drop Python 3.9 and use X|Y typing (#2719)
anakin87 Jan 12, 2026
821e0bf
Update the changelog
HaystackBot Jan 12, 2026
197c5e2
feat: Update Nvidia components to auto call run `warm_up` and don't m…
sjrl Jan 13, 2026
3579906
Update the changelog
HaystackBot Jan 13, 2026
18d6372
fix: AmazonBedrockDocumentEmbedder to not modify Documents in place (…
GunaPalanivel Jan 13, 2026
3982525
Update the changelog
HaystackBot Jan 13, 2026
445dcbd
chore!: openrouter - drop Python 3.9 and use X|Y typing (#2720)
anakin87 Jan 13, 2026
e80c0ed
Update the changelog
HaystackBot Jan 13, 2026
d80695c
chore!: optimum - drop Python 3.9 and use X|Y typing (#2721)
anakin87 Jan 13, 2026
6896600
Update the changelog
HaystackBot Jan 13, 2026
90365e2
chore!: pinecone - drop Python 3.9 and use X|Y typing (#2723)
anakin87 Jan 13, 2026
fb64bbf
Update the changelog
HaystackBot Jan 13, 2026
7c50550
chore!: qdrant - drop Python 3.9 and use X|Y typing (#2726)
anakin87 Jan 13, 2026
03348d0
chore!: ragas - drop Python 3.9 and use X|Y typing (#2727)
anakin87 Jan 13, 2026
21454dd
Update the changelog
HaystackBot Jan 13, 2026
16ab08a
ci: fix version validation pattern (#2728)
anakin87 Jan 13, 2026
97952b8
Update the changelog
HaystackBot Jan 13, 2026
6cdb737
chore!: snowflake - drop Python 3.9 and use X|Y typing (#2729)
anakin87 Jan 13, 2026
6334284
Update the changelog
HaystackBot Jan 13, 2026
d638a30
ci: extend pattern for 'Sync API reference with Docusaurus' workflow …
anakin87 Jan 13, 2026
6cfff64
chore!: stackit - drop Python 3.9 and use X|Y typing (#2730)
anakin87 Jan 13, 2026
e2e3b6c
Update the changelog
HaystackBot Jan 13, 2026
e7ea3d7
chore!: togetherai - drop Python 3.9 and use X|Y typing (#2731)
anakin87 Jan 13, 2026
2561521
Update the changelog
HaystackBot Jan 13, 2026
9c5367b
chore!: unstructured - drop Python 3.9 and use X|Y typing (#2732)
anakin87 Jan 13, 2026
5d37f40
Update the changelog
HaystackBot Jan 13, 2026
fd7fa38
chore!: weaviate - drop Python 3.9 and use X|Y typing (#2733)
anakin87 Jan 13, 2026
b08e8dc
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
53d57c6
Update the changelog
HaystackBot Jan 13, 2026
7aa6ddb
chore!: weights_and_biases_weave - drop Python 3.9 and use X|Y typing…
anakin87 Jan 13, 2026
962df0b
updating function names + tests
davidsbatista Jan 13, 2026
ac86676
adding SQLRetriever + tests
davidsbatista Jan 13, 2026
bd6cce0
adding missing files
davidsbatista Jan 13, 2026
047b4f5
adding missing files
davidsbatista Jan 13, 2026
f5afd39
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
504e589
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
9663191
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
2dda2e4
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
13d9cfa
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
2f6c9ce
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
c7c0357
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
acabd80
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
5ae642e
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
49222e2
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
ee25331
Update integrations/opensearch/src/haystack_integrations/document_sto…
davidsbatista Jan 13, 2026
2ee36f4
chore: standardize Weave integration (#2738)
anakin87 Jan 13, 2026
eac176d
Update the changelog
HaystackBot Jan 13, 2026
a48f537
chore!: nvidia - drop Python 3.9 and use X|Y typing; fix default rera…
anakin87 Jan 13, 2026
7332df6
chore: standardize Weave integration - pt.2 (#2739)
anakin87 Jan 13, 2026
9cca83f
add new supported regions (#2725)
SaraCalla Jan 13, 2026
d8e31a0
Update the changelog
HaystackBot Jan 13, 2026
8d23100
fixes
davidsbatista Jan 13, 2026
eb4526a
updating function names + tests
davidsbatista Jan 13, 2026
2489ccd
resolving conflicts
davidsbatista Jan 16, 2026
a43c741
Merge branch 'main' into feat/add-count-filtering-to-ElasticSearchDoc…
davidsbatista Jan 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ Please check out our [Contribution Guidelines](CONTRIBUTING.md) for all the deta
| [watsonx-haystack](integrations/watsonx/) | Embedder, Generator | [![PyPI - Version](https://img.shields.io/pypi/v/watsonx-haystack.svg?color=orange)](https://pypi.org/project/watsonx-haystack) | [![Test / watsonx](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/watsonx.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/watsonx.yml) | |
| [weave-haystack](integrations/weave/) | Tracer | [![PyPI - Version](https://img.shields.io/pypi/v/weave-haystack.svg)](https://pypi.org/project/weave-haystack) | [![Test / weave](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/weave.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/weave.yml) |
| [weaviate-haystack](integrations/weaviate/) | Document Store | [![PyPI - Version](https://img.shields.io/pypi/v/weaviate-haystack.svg)](https://pypi.org/project/weaviate-haystack) | [![Test / weaviate](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/weaviate.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/weaviate.yml) |
<<<<<<< HEAD
| [weave-haystack](integrations/weave/) | Tracer | [![PyPI - Version](https://img.shields.io/pypi/v/weave-haystack.svg)](https://pypi.org/project/weave-haystack) | [![Test / weave](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/weave.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/weave.yml) |
=======
>>>>>>> main
| [instructor-embedders-haystack](integrations/instructor_embedders/) | Embedder | [![PyPI - Version](https://img.shields.io/pypi/v/instructor-embedders-haystack.svg)](https://pypi.org/project/instructor-embedders-haystack) | [Staged](https://docs.haystack.deepset.ai/docs/breaking-change-policy#discontinuing-an-integration) |

## Releasing
Expand Down
2 changes: 1 addition & 1 deletion integrations/amazon_bedrock/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,4 +554,4 @@

- [Amazon Bedrock] Add AmazonBedrockGenerator (#153)

<!-- generated by git-cliff -->
<!-- generated by git-cliff -->

Large diffs are not rendered by default.

348 changes: 348 additions & 0 deletions integrations/elasticsearch/tests/test_document_store.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integrations/google_genai/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@

- Add Google GenAI GoogleGenAIChatGenerator (#1875)

<!-- generated by git-cliff -->
<!-- generated by git-cliff -->
3 changes: 2 additions & 1 deletion integrations/opensearch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ classifiers = [
]
dependencies = [
"haystack-ai>=2.22.0",
"opensearch-py[async]>=2.4.0,<3"
"opensearch-py[async]>=2.4.0,<3",
"httpx>=0.28.1"
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@
from .bm25_retriever import OpenSearchBM25Retriever
from .embedding_retriever import OpenSearchEmbeddingRetriever
from .open_search_hybrid_retriever import OpenSearchHybridRetriever
from .sql_retriever import OpenSearchSQLRetriever

__all__ = ["OpenSearchBM25Retriever", "OpenSearchEmbeddingRetriever", "OpenSearchHybridRetriever"]
__all__ = [
"OpenSearchBM25Retriever",
"OpenSearchEmbeddingRetriever",
"OpenSearchHybridRetriever",
"OpenSearchSQLRetriever",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# SPDX-FileCopyrightText: 2023-present deepset GmbH <info@deepset.ai>
#
# SPDX-License-Identifier: Apache-2.0

from typing import Any, Optional

from haystack import component, default_from_dict, default_to_dict, logging

from haystack_integrations.document_stores.opensearch import OpenSearchDocumentStore
from haystack_integrations.document_stores.opensearch.document_store import ResponseFormat

logger = logging.getLogger(__name__)


@component
class OpenSearchSQLRetriever:
"""
Executes raw OpenSearch SQL queries against an OpenSearchDocumentStore.

This component allows you to execute SQL queries directly against the OpenSearch index,
which is useful for fetching metadata, aggregations, and other structured data at runtime.
"""

def __init__(
self,
*,
document_store: OpenSearchDocumentStore,
response_format: ResponseFormat = "json",
raise_on_failure: bool = True,
):
"""
Creates the OpenSearchSQLRetriever component.

:param document_store: An instance of OpenSearchDocumentStore to use with the Retriever.
:param response_format: The format of the response. See https://docs.opensearch.org/latest/search-plugins/sql/response-formats/
- `json`: Returns a list of dictionaries (the _source from each hit). Default.
- `csv`: Returns the response as CSV text.
- `jdbc`: Returns the response in JDBC format.
- `raw`: Returns the raw response as text.
:param raise_on_failure:
Whether to raise an exception if the API call fails. Otherwise, log a warning and return None.

:raises ValueError: If `document_store` is not an instance of OpenSearchDocumentStore.
"""
if not isinstance(document_store, OpenSearchDocumentStore):
msg = "document_store must be an instance of OpenSearchDocumentStore"
raise ValueError(msg)

self._document_store = document_store
self._response_format = response_format
self._raise_on_failure = raise_on_failure

def to_dict(self) -> dict[str, Any]:
"""
Serializes the component to a dictionary.

:returns:
Dictionary with serialized data.
"""
return default_to_dict(
self,
document_store=self._document_store.to_dict(),
response_format=self._response_format,
raise_on_failure=self._raise_on_failure,
)

@classmethod
def from_dict(cls, data: dict[str, Any]) -> "OpenSearchSQLRetriever":
"""
Deserializes the component from a dictionary.

:param data:
Dictionary to deserialize from.

:returns:
Deserialized component.
"""
data["init_parameters"]["document_store"] = OpenSearchDocumentStore.from_dict(
data["init_parameters"]["document_store"]
)
return default_from_dict(cls, data)

@component.output_types(result=Any)
def run(
self,
query: str,
response_format: Optional[ResponseFormat] = None,
document_store: Optional[OpenSearchDocumentStore] = None,
) -> dict[str, Any]:
"""
Execute a raw OpenSearch SQL query against the index.

:param query: The OpenSearch SQL query to execute.
:param response_format: The format of the response. If not provided, uses the format
specified during initialization. See https://docs.opensearch.org/latest/search-plugins/sql/response-formats/
:param document_store: Optionally, an instance of OpenSearchDocumentStore to use with the Retriever.

:returns:
A dictionary containing the query results with the following structure:
- result: The query results in the specified format. For JSON format, returns a list of dictionaries
(the _source from each hit). For other formats (csv, jdbc, raw), returns the response as text.

Example:
```python
retriever = OpenSearchSQLRetriever(document_store=document_store)
result = retriever.run(
query="SELECT content, category FROM my_index WHERE category = 'A'"
)
# result["result"] contains a list of dictionaries with the query results
```
"""
if document_store is not None:
if not isinstance(document_store, OpenSearchDocumentStore):
msg = "document_store must be an instance of OpenSearchDocumentStore"
raise ValueError(msg)
doc_store = document_store
else:
doc_store = self._document_store

response_format = response_format or self._response_format

try:
result = doc_store._query_sql(query=query, response_format=response_format)
except Exception as e:
if self._raise_on_failure:
raise e
else:
logger.warning(
"An error during SQL query execution occurred and will be ignored by returning None: {error}",
error=str(e),
exc_info=True,
)
result = None

return {"result": result}

@component.output_types(result=Any)
async def run_async(
self,
query: str,
response_format: Optional[ResponseFormat] = None,
document_store: Optional[OpenSearchDocumentStore] = None,
) -> dict[str, Any]:
"""
Asynchronously execute a raw OpenSearch SQL query against the index.

:param query: The OpenSearch SQL query to execute.
:param response_format: The format of the response. If not provided, uses the format
specified during initialization. See https://docs.opensearch.org/latest/search-plugins/sql/response-formats/
:param document_store: Optionally, an instance of OpenSearchDocumentStore to use with the Retriever.

:returns:
A dictionary containing the query results with the following structure:
- result: The query results in the specified format. For JSON format, returns a list of dictionaries
(the _source from each hit). For other formats (csv, jdbc, raw), returns the response as text.

Example:
```python
retriever = OpenSearchSQLRetriever(document_store=document_store)
result = await retriever.run_async(
query="SELECT content, category FROM my_index WHERE category = 'A'"
)
# result["result"] contains a list of dictionaries with the query results
```
"""
if document_store is not None:
if not isinstance(document_store, OpenSearchDocumentStore):
msg = "document_store must be an instance of OpenSearchDocumentStore"
raise ValueError(msg)
doc_store = document_store
else:
doc_store = self._document_store

response_format = response_format or self._response_format

try:
result = await doc_store._query_sql_async(query=query, response_format=response_format)
except Exception as e:
if self._raise_on_failure:
raise e
else:
logger.warning(
"An error during SQL query execution occurred and will be ignored by returning None: {error}",
error=str(e),
exc_info=True,
)
result = None

return {"result": result}
Loading
Loading