From 9c567ee727031dc9f5564e17758c4b3ee8485b6c Mon Sep 17 00:00:00 2001 From: Ronnak Saxena Date: Thu, 7 Sep 2023 13:14:42 -0700 Subject: [PATCH] resolved more comments on my PR Signed-off-by: Ronnak Saxena --- .../rollup/interceptor/ResponseInterceptor.kt | 1 + .../indexmanagement/rollup/interceptor/RollupInterceptor.kt | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/ResponseInterceptor.kt b/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/ResponseInterceptor.kt index 0e279c22c..27fabd310 100644 --- a/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/ResponseInterceptor.kt +++ b/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/ResponseInterceptor.kt @@ -219,6 +219,7 @@ class ResponseInterceptor( .source(searchSourceBuilder) /* If the response shard index is a rollup index, need to find the minimum value of all the live indices to compute the overlap + This is because I am comparing this index to all the live data to compute the interval I want to keep If the response shard index is a live index, need to only compute minimum value of the current shard index */ if (isShardIndexRollup) { diff --git a/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptor.kt b/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptor.kt index d7c15e460..85f28a9a9 100644 --- a/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptor.kt +++ b/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptor.kt @@ -196,7 +196,10 @@ class RollupInterceptor( // Only modifies rollup searches and avoids internal client calls if (containsRollup || isRollupIndex) { val (concreteRollupIndicesArray, concreteLiveIndicesArray) = getConcreteIndices(request) - // Avoid infinite interceptor loop + /* Avoid infinite interceptor loop: + if there is an internal client call made in the reponse interceptor there is only 1 index. + Therefore, conditions are not met for api to combine rollup and live data + */ val isMultiSearch = (concreteRollupIndicesArray.isNotEmpty() && concreteLiveIndicesArray.isNotEmpty()) if (isMultiSearch && request.source().aggregations() != null && !isRequestRewrittenIntoBuckets(request)) { // Break apart request to remove overlapping parts