diff --git a/integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/bm25_retriever.py b/integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/bm25_retriever.py index f5d45d2b8..4a8478e2c 100644 --- a/integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/bm25_retriever.py +++ b/integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/bm25_retriever.py @@ -73,8 +73,16 @@ def __init__( An example `run()` method for this `custom_query`: ```python - retriever.run(query="Why did the revenue increase?", - filters={"years": ["2019"], "quarters": ["Q1", "Q2"]}) + retriever.run( + query="Why did the revenue increase?", + filters={ + "operator": "AND", + "conditions": [ + {"field": "meta.years", "operator": "==", "value": "2019"}, + {"field": "meta.quarters", "operator": "in", "value": ["Q1", "Q2"]}, + ], + }, + ) ``` :param raise_on_failure: Whether to raise an exception if the API call fails. Otherwise log a warning and return an empty list. @@ -184,8 +192,16 @@ def run( **For this custom_query, a sample `run()` could be:** ```python - retriever.run(query="Why did the revenue increase?", - filters={"years": ["2019"], "quarters": ["Q1", "Q2"]}) + retriever.run( + query="Why did the revenue increase?", + filters={ + "operator": "AND", + "conditions": [ + {"field": "meta.years", "operator": "==", "value": "2019"}, + {"field": "meta.quarters", "operator": "in", "value": ["Q1", "Q2"]}, + ], + }, + ) ``` :returns: diff --git a/integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/embedding_retriever.py b/integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/embedding_retriever.py index 1c1071a76..e159634cf 100644 --- a/integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/embedding_retriever.py +++ b/integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/embedding_retriever.py @@ -71,8 +71,16 @@ def __init__( For this `custom_query`, an example `run()` could be: ```python - retriever.run(query_embedding=embedding, - filters={"years": ["2019"], "quarters": ["Q1", "Q2"]}) + retriever.run( + query_embedding=embedding, + filters={ + "operator": "AND", + "conditions": [ + {"field": "meta.years", "operator": "==", "value": "2019"}, + {"field": "meta.quarters", "operator": "in", "value": ["Q1", "Q2"]}, + ], + }, + ) ``` :param raise_on_failure: If `True`, raises an exception if the API call fails. @@ -176,8 +184,16 @@ def run( For this `custom_query`, an example `run()` could be: ```python - retriever.run(query_embedding=embedding, - filters={"years": ["2019"], "quarters": ["Q1", "Q2"]}) + retriever.run( + query_embedding=embedding, + filters={ + "operator": "AND", + "conditions": [ + {"field": "meta.years", "operator": "==", "value": "2019"}, + {"field": "meta.quarters", "operator": "in", "value": ["Q1", "Q2"]}, + ], + }, + ) ``` :returns: