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 389bc6628..2ce656c57 100644 --- a/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/ResponseInterceptor.kt +++ b/src/main/kotlin/org/opensearch/indexmanagement/rollup/interceptor/ResponseInterceptor.kt @@ -135,7 +135,7 @@ class ResponseInterceptor( // Need to avoid infinite interceptor loop val req = SearchRequest() .source(searchSourceBuilder) - rollupIndices.forEach { req.indices(it) } + .indices(*rollupIndices) var res: SearchResponse? = null val latch = CountDownLatch(1) client.search( @@ -191,7 +191,7 @@ class ResponseInterceptor( // Need to avoid infinite interceptor loop val maxRolledDateRequest = SearchRequest() .source(searchSourceBuilder) - rollupIndices.forEach { maxRolledDateRequest.indices(it) } // add all rollup indices to this request + .indices(*rollupIndices) // add all rollup indices to this request var maxRolledDateResponse: SearchResponse? = null var latch = CountDownLatch(1) client.search( @@ -221,7 +221,7 @@ class ResponseInterceptor( If the response shard index is a live index, need to only compute minimum value of the current shard index */ if (isShardIndexRollup) { - liveIndices.forEach { minLiveDateRequest.indices(it) } + minLiveDateRequest.indices(*liveIndices) } else { // shard index is live index minLiveDateRequest.indices(shardRequestIndex) } diff --git a/src/test/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptorIT.kt b/src/test/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptorIT.kt index e42295418..105cc20c6 100644 --- a/src/test/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptorIT.kt +++ b/src/test/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptorIT.kt @@ -1045,21 +1045,6 @@ class RollupInterceptorIT : RollupRestTestCase() { } } """.trimIndent() - // Search 1 non-rollup index and 1 rollup - val searchResult1 = client().makeRequest("POST", "/$sourceIndex2,$targetIndex2/_search", emptyMap(), StringEntity(req, ContentType.APPLICATION_JSON)) - assertTrue(searchResult1.restStatus() == RestStatus.OK) - val failures = extractFailuresFromSearchResponse(searchResult1) - assertNotNull(failures) - assertEquals(1, failures?.size) - assertEquals( - "Searching multiple indices where one is rollup and other is not, didn't return failure", - "illegal_argument_exception", failures?.get(0)?.get("type") ?: "Didn't find failure type in search response" - - ) - assertEquals( - "Searching multiple indices where one is rollup and other is not, didn't return failure", - "Not all indices have rollup job", failures?.get(0)?.get("reason") ?: "Didn't find failure reason in search response" - ) // Search 2 rollups with different mappings try {