Skip to content

Commit 5eb0616

Browse files
committed
Added param ignore_throttled=false when indicesOptions.ignoreThrottled() is false
fix test RequestConvertersTests and added ignore_throttled on all request
1 parent a568c3c commit 5eb0616

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,7 @@ Params withIndicesOptions(IndicesOptions indicesOptions) {
939939
expandWildcards = joiner.toString();
940940
}
941941
putParam("expand_wildcards", expandWildcards);
942+
putParam("ignore_throttled", Boolean.toString(indicesOptions.ignoreThrottled()));
942943
}
943944
return this;
944945
}

client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ public void testFieldCaps() {
15611561
endpoint.add("_field_caps");
15621562

15631563
assertEquals(endpoint.toString(), request.getEndpoint());
1564-
assertEquals(4, request.getParameters().size());
1564+
assertEquals(5, request.getParameters().size());
15651565

15661566
// Note that we don't check the field param value explicitly, as field names are
15671567
// passed through
@@ -1595,7 +1595,7 @@ public void testRankEval() throws Exception {
15951595
}
15961596
endpoint.add(RestRankEvalAction.ENDPOINT);
15971597
assertEquals(endpoint.toString(), request.getEndpoint());
1598-
assertEquals(3, request.getParameters().size());
1598+
assertEquals(4, request.getParameters().size());
15991599
assertEquals(expectedParams, request.getParameters());
16001600
assertToXContentBody(spec, request.getEntity());
16011601
}
@@ -1922,7 +1922,8 @@ static void setRandomIndicesOptions(Consumer<IndicesOptions> setter, Supplier<In
19221922
Map<String, String> expectedParams) {
19231923

19241924
if (randomBoolean()) {
1925-
setter.accept(IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean()));
1925+
setter.accept(IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(),
1926+
true, false, false, randomBoolean()));
19261927
}
19271928
expectedParams.put("ignore_unavailable", Boolean.toString(getter.get().ignoreUnavailable()));
19281929
expectedParams.put("allow_no_indices", Boolean.toString(getter.get().allowNoIndices()));
@@ -1935,11 +1936,13 @@ static void setRandomIndicesOptions(Consumer<IndicesOptions> setter, Supplier<In
19351936
} else {
19361937
expectedParams.put("expand_wildcards", "none");
19371938
}
1939+
expectedParams.put("ignore_throttled", Boolean.toString(getter.get().ignoreThrottled()));
19381940
}
19391941

19401942
static IndicesOptions setRandomIndicesOptions(IndicesOptions indicesOptions, Map<String, String> expectedParams) {
19411943
if (randomBoolean()) {
1942-
indicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean());
1944+
indicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(),
1945+
true, false, false, randomBoolean());
19431946
}
19441947
expectedParams.put("ignore_unavailable", Boolean.toString(indicesOptions.ignoreUnavailable()));
19451948
expectedParams.put("allow_no_indices", Boolean.toString(indicesOptions.allowNoIndices()));
@@ -1952,6 +1955,7 @@ static IndicesOptions setRandomIndicesOptions(IndicesOptions indicesOptions, Map
19521955
} else {
19531956
expectedParams.put("expand_wildcards", "none");
19541957
}
1958+
expectedParams.put("ignore_throttled", Boolean.toString(indicesOptions.ignoreThrottled()));
19551959
return indicesOptions;
19561960
}
19571961

0 commit comments

Comments
 (0)