mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-13 13:36:15 +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:
@@ -775,7 +775,7 @@ class ElasticsearchStore(VectorStore):
|
||||
docs_and_scores.append(
|
||||
(
|
||||
Document(
|
||||
page_content=hit["_source"][self.query_field],
|
||||
page_content=hit["_source"].get(self.query_field, ""),
|
||||
metadata=hit["_source"]["metadata"],
|
||||
),
|
||||
hit["_score"],
|
||||
|
Reference in New Issue
Block a user