Filtering on nested metadata not allowed #40

Open
opened 2026-02-16 05:16:15 -05:00 by yindo · 0 comments
Owner

Originally created by @jadendick on GitHub (Sep 6, 2024).

When trying to filter by metadata that contains nested JSON objects, the field name is rejected since it contains '.'. For example:

Metadata: {"common": {"source": "confluence"}}
Filter: {"common.source": "confluence"}
This does not work because of the '.' which is currently not allowed but is a valid JsonPath.

I believe this can be fixed by changing the check here, perhaps to a simple regex function that allows '.': https://github.com/langchain-ai/langchain-postgres/blob/6d4f6f36d56db1e784c690d27a915e36a23ed4d9/langchain_postgres/vectorstores.py#L103

Thank you

Originally created by @jadendick on GitHub (Sep 6, 2024). When trying to filter by metadata that contains nested JSON objects, the field name is rejected since it contains '.'. For example: Metadata: `{"common": {"source": "confluence"}}` Filter: `{"common.source": "confluence"}` This does not work because of the '.' which is currently not allowed but is a valid [JsonPath](https://github.com/json-path/JsonPath). I believe this can be fixed by changing the check here, perhaps to a simple regex function that allows '.': https://github.com/langchain-ai/langchain-postgres/blob/6d4f6f36d56db1e784c690d27a915e36a23ed4d9/langchain_postgres/vectorstores.py#L103 Thank you
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langchain-postgres#40