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
pull/11779/head
Hristo G 9 months ago committed by GitHub
parent f06fcde0d7
commit 7fb25b4154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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"],

Loading…
Cancel
Save