Replies: 3 comments 2 replies
-
The error you're encountering is due to the document IDs not being recognized as valid by the OpenSearch VECTORSEARCH index during the delete operation. This could be because of the format or the existence of the IDs in the index. Here's how you can address this:
The document IDs are expected to be strings, as indicated by the use of If these steps do not resolve the issue, further investigation into the specific error messages or logs might be necessary for more targeted troubleshooting. Sources
|
Beta Was this translation helpful? Give feedback.
-
FWIW, I ran into this as well and had to hack the code a bit such that the ID is not the autogenerated one from LangChain but rather the id from the OpenSearch hit |
Beta Was this translation helpful? Give feedback.
-
I'm facing the exact same issue on my application as well - basically that delete operations don't work with OpenSearch Serverless via LangChain's Indexing API. Anybody got any thoughts on this? Here's a snippet of my traceback -
and the list goes on. |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
I am trying to test out using index deletion modes with my opensearch vectorstore but when trying to run through this quickstart guide I am running into an error when it tries to delete documents from opensearch.
File "/usr/local/lib/python3.9/site-packages/langchain/indexes/_api.py", line 373, in index vector_store.delete(uids_to_delete) File "/usr/local/lib/python3.9/site-packages/langchain_community/vectorstores/opensearch_vector_search.py", line 635, in delete raise e File "/usr/local/lib/python3.9/site-packages/langchain_community/vectorstores/opensearch_vector_search.py", line 632, in delete bulk(self.client, body, refresh=refresh_indices, ignore_status=404) File "/usr/local/lib/python3.9/site-packages/opensearchpy/helpers/actions.py", line 424, in bulk for ok, item in streaming_bulk(client, actions, ignore_status=ignore_status, *args, **kwargs): # type: ignore File "/usr/local/lib/python3.9/site-packages/opensearchpy/helpers/actions.py", line 337, in streaming_bulk for data, (ok, info) in zip( File "/usr/local/lib/python3.9/site-packages/opensearchpy/helpers/actions.py", line 272, in _process_bulk_chunk for item in gen: File "/usr/local/lib/python3.9/site-packages/opensearchpy/helpers/actions.py", line 201, in _process_bulk_chunk_success raise BulkIndexError("%i document(s) failed to index." % len(errors), errors) opensearchpy.helpers.errors.BulkIndexError: ('2 document(s) failed to index.', [{'delete': {'_index': 'test_index', '_id': '2a7c9f28-7763-52c1-b3ea-9aef92133476', 'status': 400, 'error': {'type': 'illegal_argument_exception', 'reason': 'Invalid external document id:[2a7c9f28-7763-52c1-b3ea-9aef92133476] for index type: [VECTORSEARCH].'}}}, {'delete': {'_index': 'test_index', '_id': '71f94ed4-56f0-56c1-9193-667149806f60', 'status': 400, 'error': {'type': 'illegal_argument_exception', 'reason': 'Invalid external document id:[71f94ed4-56f0-56c1-9193-667149806f60] for index type: [VECTORSEARCH].'}}}])
The documentation claims this is compatible with OpenSearchVectorSearch.
System Info
langchain==0.1.15
langchain-community==0.0.32
langchain-core==0.1.41
langchain-openai==0.0.2.post1
langchain-text-splitters==0.0.1
langchainhub==0.1.14
platform: mac
python version: Python 3.9.16 (also tried with most recent version)
Beta Was this translation helpful? Give feedback.
All reactions