Skip to content

OpenSearch Serverless Incompatibility in v1.0.0 #3739

@Malhis

Description

@Malhis

🐛 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 126

The 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

  1. Set up AWS OpenSearch Serverless collection
  2. 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 404

Expected Behavior

Vector insertion should work with both OpenSearch self-managed and Serverless offerings.

Actual Behavior

Vector insertion fails with NotFoundError(404) on OpenSearch Serverless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions