diff --git a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/FilterRewriteIT.java b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/FilterRewriteIT.java index ee1ced60e68e4..3d75315a288b4 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/FilterRewriteIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/FilterRewriteIT.java @@ -9,6 +9,7 @@ package org.opensearch.search.aggregations.bucket; import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; + import org.opensearch.action.index.IndexRequestBuilder; import org.opensearch.action.search.SearchResponse; import org.opensearch.common.settings.Settings; @@ -69,7 +70,6 @@ protected void setupSuiteScopeCluster() throws Exception { for (int i = 0; i < segmentCount; i++) { final List indexRequests = new ArrayList<>(); - long longTerm; do { longTerm = randomInt(segmentCount * 2); @@ -81,15 +81,10 @@ protected void setupSuiteScopeCluster() throws Exception { for (int j = 0; j < frequency; j++) { indexRequests.add( client().prepareIndex("idx") - .setSource( - jsonBuilder().startObject() - .field("date", dateTerm) - .field("match", true) - .endObject() - ) + .setSource(jsonBuilder().startObject().field("date", dateTerm).field("match", true).endObject()) ); } - expected.put(dateTerm+"T00:00:00.000Z", (long) frequency); + expected.put(dateTerm + "T00:00:00.000Z", (long) frequency); indexRandom(true, false, indexRequests); } @@ -103,17 +98,13 @@ public void testMinDocCountOnDateHistogram() throws Exception { final SearchResponse allResponse = client().prepareSearch("idx") .setSize(0) .setQuery(QUERY) - .addAggregation( - dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0) - ) + .addAggregation(dateHistogram("histo").field("date").dateHistogramInterval(DateHistogramInterval.DAY).minDocCount(0)) .get(); final Histogram allHisto = allResponse.getAggregations().get("histo"); logger.info("allHisto={}", allHisto); Map results = new HashMap<>(); - allHisto.getBuckets().forEach(bucket -> - results.put(bucket.getKeyAsString(), bucket.getDocCount()) - ); + allHisto.getBuckets().forEach(bucket -> results.put(bucket.getKeyAsString(), bucket.getDocCount())); for (Map.Entry entry : expected.entrySet()) { assertEquals(entry.getValue(), results.get(entry.getKey())); diff --git a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/MinDocCountIT.java b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/MinDocCountIT.java index c6f82270b67f4..c3a64417cf315 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/MinDocCountIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/MinDocCountIT.java @@ -34,10 +34,8 @@ import com.carrotsearch.randomizedtesting.generators.RandomStrings; -import org.opensearch.action.admin.indices.segments.IndexShardSegments; import org.opensearch.action.admin.indices.segments.IndicesSegmentResponse; import org.opensearch.action.admin.indices.segments.IndicesSegmentsRequest; -import org.opensearch.action.admin.indices.segments.ShardSegments; import org.opensearch.action.index.IndexRequestBuilder; import org.opensearch.action.search.SearchRequest; import org.opensearch.action.search.SearchResponse; @@ -46,7 +44,6 @@ import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.core.xcontent.ToXContent; import org.opensearch.core.xcontent.XContentBuilder; -import org.opensearch.index.engine.Segment; import org.opensearch.index.fielddata.ScriptDocValues; import org.opensearch.index.query.QueryBuilder; import org.opensearch.index.query.QueryBuilders; diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/FastFilterRewriteHelper.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/FastFilterRewriteHelper.java index bf2804174037f..b9df50aa01053 100644 --- a/server/src/main/java/org/opensearch/search/aggregations/bucket/FastFilterRewriteHelper.java +++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/FastFilterRewriteHelper.java @@ -340,7 +340,6 @@ public Weight[] buildFastFilter(LeafReaderContext leaf, SearchContext context) t private Weight[] buildFastFilter(SearchContext context, long[] bounds) throws IOException { bounds = processHardBounds(bounds); - logger.debug("Bounds are {} for shard {} with hard bound", bounds, context.indexShard().shardId()); if (bounds == null) { return null; } @@ -424,11 +423,6 @@ public static boolean tryFastFilterAggregation( if (!fastFilterContext.rewriteable) { return false; } - logger.debug( - "try fast filter on Shard {} segment {}", - fastFilterContext.context.indexShard().shardId(), - ctx.ord - ); NumericDocValues docCountValues = DocValues.getNumeric(ctx.reader(), DocCountFieldMapper.NAME); if (docCountValues.nextDoc() != NO_MORE_DOCS) { @@ -447,11 +441,6 @@ public static boolean tryFastFilterAggregation( } Weight[] filters = fastFilterContext.filters; boolean filtersBuiltAtSegmentLevel = false; - logger.debug( - "Shard {} segment {} functionally match all documents", - fastFilterContext.context.indexShard().shardId(), - ctx.ord - ); if (filters == null) { logger.debug( "Shard {} segment {} functionally match all documents. Build the fast filter", @@ -498,7 +487,7 @@ public static boolean tryFastFilterAggregation( } } - // each segment computes its own filters, so reset + // each segment computes its own filters, so reset the filters built at segment if (filtersBuiltAtSegmentLevel) { fastFilterContext.filters = null; } @@ -509,12 +498,6 @@ public static boolean tryFastFilterAggregation( private static boolean segmentMatchAll(SearchContext ctx, LeafReaderContext leafCtx) throws IOException { Weight weight = ctx.searcher().createWeight(ctx.query(), ScoreMode.COMPLETE_NO_SCORES, 1f); - if (weight == null) { - return false; - } - int count = weight.count(leafCtx); - int numDocs = leafCtx.reader().numDocs(); - logger.debug("Shard {} segment {} has {} count and {} num docs", ctx.indexShard().shardId(), leafCtx.ord, count, numDocs); return weight != null && weight.count(leafCtx) == leafCtx.reader().numDocs(); } }