From 82d62c46a37b6e3a92a03ac3f2a37d494f63d8ad Mon Sep 17 00:00:00 2001 From: Hailong Cui Date: Thu, 7 Dec 2023 08:47:32 +0800 Subject: [PATCH] Using trace number as sort key Signed-off-by: Hailong Cui --- .../org/opensearch/ml/memory/index/InteractionsIndex.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/memory/src/main/java/org/opensearch/ml/memory/index/InteractionsIndex.java b/memory/src/main/java/org/opensearch/ml/memory/index/InteractionsIndex.java index e892435019..903f30e810 100644 --- a/memory/src/main/java/org/opensearch/ml/memory/index/InteractionsIndex.java +++ b/memory/src/main/java/org/opensearch/ml/memory/index/InteractionsIndex.java @@ -337,10 +337,7 @@ public void getTraces(String interactionId, int from, int maxResults, ActionList request.source(searchSourceBuilder); request.source().from(from).size(maxResults); - request - .source() - .sort(ConversationalIndexConstants.INTERACTIONS_CREATE_TIME_FIELD, SortOrder.ASC) - .sort(ConversationalIndexConstants.INTERACTIONS_TRACE_NUMBER_FIELD, SortOrder.ASC); + request.source().sort(ConversationalIndexConstants.INTERACTIONS_TRACE_NUMBER_FIELD, SortOrder.ASC); try (ThreadContext.StoredContext threadContext = client.threadPool().getThreadContext().stashContext()) { ActionListener> internalListener = ActionListener.runBefore(listener, () -> threadContext.restore()); ActionListener al = ActionListener.wrap(response -> {