Fix AsyncSearchActionIT#testTermsAggregation (#55924)

This commit fixes the initialization of total hits
in the async search response.

Relates #55683
Closes #55920
This commit is contained in:
Jim Ferenczi 2020-04-29 14:55:42 +02:00 committed by jimczi
parent ae4d980c8c
commit 293c81dd59
2 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ class MutableSearchResponse {
/**
* How we get the reduced aggs when {@link #finalResponse} isn't populated.
* We default to returning no aggs, this {@code -> null}. We'll replace
* this as we receive updates on the search progress listener.
* this as we receive updates on the search progress listener.
*/
private Supplier<InternalAggregations> reducedAggsSource = () -> null;
private int reducePhase;
@ -77,6 +77,7 @@ class MutableSearchResponse {
this.shardFailures = totalShards == -1 ? null : new AtomicArray<>(totalShards-skippedShards);
this.isPartial = true;
this.threadContext = threadContext;
this.totalHits = new TotalHits(0L, TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO);
}
/**
@ -150,7 +151,7 @@ class MutableSearchResponse {
return finalResponse;
}
if (clusters == null) {
// An error occurred before we got the shard list
// An error occurred before we got the shard list
return null;
}
/*

View File

@ -123,7 +123,6 @@ public class AsyncSearchActionIT extends AsyncSearchIntegTestCase {
}
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/55920")
public void testTermsAggregation() throws Exception {
int step = numShards > 2 ? randomIntBetween(2, numShards) : 2;
int numFailures = randomBoolean() ? randomIntBetween(0, numShards) : 0;