mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-30 11:39:03 +00:00
Add graceful fallback for ES vectorstore when content field is missing (#11726)
- **Description:** - If the Elasticsearch field used for Langchain > Document.page_content is missing because the specific document is somehow malformed fail gracefully. - **Tag maintainer:** - @joemcelroy
This commit is contained in:
parent
f06fcde0d7
commit
7fb25b4154
@ -775,7 +775,7 @@ class ElasticsearchStore(VectorStore):
|
|||||||
docs_and_scores.append(
|
docs_and_scores.append(
|
||||||
(
|
(
|
||||||
Document(
|
Document(
|
||||||
page_content=hit["_source"][self.query_field],
|
page_content=hit["_source"].get(self.query_field, ""),
|
||||||
metadata=hit["_source"]["metadata"],
|
metadata=hit["_source"]["metadata"],
|
||||||
),
|
),
|
||||||
hit["_score"],
|
hit["_score"],
|
||||||
|
Loading…
Reference in New Issue
Block a user