diff --git a/memory/src/main/java/org/opensearch/ml/memory/index/ConversationMetaIndex.java b/memory/src/main/java/org/opensearch/ml/memory/index/ConversationMetaIndex.java index 5480b8ad96..a75e2aa0c0 100644 --- a/memory/src/main/java/org/opensearch/ml/memory/index/ConversationMetaIndex.java +++ b/memory/src/main/java/org/opensearch/ml/memory/index/ConversationMetaIndex.java @@ -173,6 +173,7 @@ public void createConversation(ActionListener listener) { public void getConversations(int from, int maxResults, ActionListener> listener) { if (!clusterService.state().metadata().hasIndex(indexName)) { listener.onResponse(List.of()); + return; } SearchRequest request = Requests.searchRequest(indexName); String userstr = client.threadPool().getThreadContext().getTransient(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT); @@ -226,6 +227,7 @@ public void getConversations(int maxResults, ActionListener listener) { if (!clusterService.state().metadata().hasIndex(indexName)) { listener.onResponse(true); + return; } DeleteRequest delRequest = Requests.deleteRequest(indexName).id(conversationId); String userstr = client.threadPool().getThreadContext().getTransient(ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT);