-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
🐛 Describe the bug
Issue Summary
mem0 v1.0.0 is incompatible with AWS OpenSearch Serverless due to use of the indices.refresh() API call, which is not supported in the Serverless offering.
Environment
- mem0 version: 1.0.0
- Vector store: OpenSearch Serverless (AWS managed)
- Python version: 3.12
Description
The Problem
After upgrading from mem0 v0.1.118 to v1.0.0, all vector insertion operations fail with NotFoundError(404, '') when using OpenSearch Serverless.
Root Cause
In v1.0.0, a call to indices.refresh() was added after every vector insertion (line 126 in mem0/vector_stores/opensearch.py):
def insert(self, vectors, payloads=None, ids=None):
# ... insertion code ...
try:
self.client.index(index=self.collection_name, body=body)
# Force refresh to make documents immediately searchable for tests
self.client.indices.refresh(index=self.collection_name) # ← Line 126The issue: OpenSearch Serverless does not support the indices.refresh() API. This is an administrative operation that doesn't exist in the managed serverless service.
Error Stacktrace
opensearchpy.exceptions.NotFoundError: NotFoundError(404, '')
File "/var/task/mem0/vector_stores/opensearch.py", line 126, in insert
self.client.indices.refresh(index=self.collection_name)According to the code comment, the refresh was added to "make documents immediately searchable for tests". However, OpenSearch automatically refreshes indices periodically.
Reproduction Steps
- Set up AWS OpenSearch Serverless collection
- Configure mem0 v1.0.0 with OpenSearch Serverless:
from mem0 import Memory
config = {
"vector_store": {
"provider": "opensearch",
"config": {
"host": "xxxxx.us-west-2.aoss.amazonaws.com",
"port": 443,
"use_ssl": True,
"http_auth": auth,
"collection_name": "my-collection"
}
}
}
memory = Memory.from_config(config)
memory.add("Test message", user_id="test") # ← Fails with 404Expected Behavior
Vector insertion should work with both OpenSearch self-managed and Serverless offerings.
Actual Behavior
Vector insertion fails with NotFoundError(404) on OpenSearch Serverless.