Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the tests for concurrent search #11207

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void testEmptyQueryString() throws ExecutionException, InterruptedExcepti
}

// see https://github.com/elastic/elasticsearch/issues/3177
public void testIssue3177() {
public void testIssue3177() throws InterruptedException {
createIndex("test");
client().prepareIndex("test").setId("1").setSource("field1", "value1").get();
client().prepareIndex("test").setId("2").setSource("field1", "value2").get();
Expand All @@ -205,6 +205,7 @@ public void testIssue3177() {
waitForRelocation();
forceMerge();
refresh();
indexRandomForConcurrentSearch("test");
assertHitCount(
client().prepareSearch()
.setQuery(matchAllQuery())
Expand Down Expand Up @@ -876,11 +877,12 @@ public void testMultiMatchQuery() throws Exception {
assertFirstHit(searchResponse, hasId("1"));
}

public void testMatchQueryZeroTermsQuery() {
public void testMatchQueryZeroTermsQuery() throws InterruptedException {
assertAcked(prepareCreate("test").setMapping("field1", "type=text,analyzer=classic", "field2", "type=text,analyzer=classic"));
client().prepareIndex("test").setId("1").setSource("field1", "value1").get();
client().prepareIndex("test").setId("2").setSource("field1", "value2").get();
refresh();
indexRandomForConcurrentSearch("test");

BoolQueryBuilder boolQuery = boolQuery().must(matchQuery("field1", "a").zeroTermsQuery(MatchQuery.ZeroTermsQuery.NONE))
.must(matchQuery("field1", "value1").zeroTermsQuery(MatchQuery.ZeroTermsQuery.NONE));
Expand All @@ -897,11 +899,12 @@ public void testMatchQueryZeroTermsQuery() {
assertHitCount(searchResponse, 2L);
}

public void testMultiMatchQueryZeroTermsQuery() {
public void testMultiMatchQueryZeroTermsQuery() throws InterruptedException {
assertAcked(prepareCreate("test").setMapping("field1", "type=text,analyzer=classic", "field2", "type=text,analyzer=classic"));
client().prepareIndex("test").setId("1").setSource("field1", "value1", "field2", "value2").get();
client().prepareIndex("test").setId("2").setSource("field1", "value3", "field2", "value4").get();
refresh();
indexRandomForConcurrentSearch("test");

BoolQueryBuilder boolQuery = boolQuery().must(
multiMatchQuery("a", "field1", "field2").zeroTermsQuery(MatchQuery.ZeroTermsQuery.NONE)
Expand Down Expand Up @@ -1944,11 +1947,12 @@ public void testRangeQueryWithLocaleMapping() throws Exception {
assertHitCount(searchResponse, 2L);
}

public void testSearchEmptyDoc() {
public void testSearchEmptyDoc() throws InterruptedException {
assertAcked(prepareCreate("test").setSettings("{\"index.analysis.analyzer.default.type\":\"keyword\"}", MediaTypeRegistry.JSON));
client().prepareIndex("test").setId("1").setSource("{}", MediaTypeRegistry.JSON).get();

refresh();
indexRandomForConcurrentSearch("test");
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1L);
}

Expand Down
Loading