@@ -1220,6 +1220,7 @@ __init__(
12201220 use_ssl: bool | None = None ,
12211221 verify_certs: bool | None = None ,
12221222 timeout: int | None = None ,
1223+ nested_fields: list[str ] | Literal[" *" ] | None = None ,
12231224 ** kwargs: Any
12241225) -> None
12251226```
@@ -1259,6 +1260,12 @@ For more information on connection parameters, see the [official OpenSearch docu
12591260- ** use_ssl** (<code >bool | None</code >) – Whether to use SSL. Defaults to None
12601261- ** verify_certs** (<code >bool | None</code >) – Whether to verify certificates. Defaults to None
12611262- ** timeout** (<code >int | None</code >) – Timeout in seconds. Defaults to None
1263+ - ** nested_fields** (<code >list\[ str\] | Literal[ '\* '] | None</code >) – List of metadata field paths (without the ` meta. ` prefix) that should be mapped
1264+ as OpenSearch ` nested ` type, enabling multi-condition filtering on array-of-objects fields.
1265+ Pass ` "*" ` to auto-detect ` list[dict] ` fields and map them as nested from
1266+ the first ` write_documents ` batch.
1267+ When the index already exists, nested fields are discovered from the live mapping.
1268+ Defaults to None (no nested support).
12621269- \*\* ** kwargs** (<code >Any</code >) – Optional arguments that ` OpenSearch ` takes. For the full list of supported kwargs,
12631270 see the [ official OpenSearch reference] ( https://opensearch-project.github.io/opensearch-py/api-ref/clients/opensearch_client.html )
12641271
@@ -1837,7 +1844,15 @@ Uses composite aggregations for proper pagination beyond 10k results.
18371844### normalize_filters
18381845
18391846``` python
1840- normalize_filters(filters: dict[str , Any]) -> dict[str , Any]
1847+ normalize_filters(
1848+ filters: dict[str , Any], nested_fields: set[str ] | None = None
1849+ ) -> dict[str , Any]
18411850```
18421851
18431852Converts Haystack filters in OpenSearch compatible filters.
1853+
1854+ ** Parameters:**
1855+
1856+ - ** filters** (<code >dict\[ str, Any\] </code >) – Haystack filter dictionary.
1857+ - ** nested_fields** (<code >set\[ str\] | None</code >) – Set of metadata field paths that are mapped as ` nested ` type in OpenSearch.
1858+ When provided, conditions targeting sub-fields of these paths are wrapped in ` nested ` queries.
0 commit comments