Skip to content

Commit c261220

Browse files
kfuksmanmartijnvg
authored andcommitted
Added param ignore_throttled=false when indicesOptions.ignoreThrottled() is false (elastic#42393)
and fixed test RequestConvertersTests and added ignore_throttled on all request
1 parent 5b5d001 commit c261220

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

+1
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@ Params withIndicesOptions(IndicesOptions indicesOptions) {
941941
expandWildcards = joiner.toString();
942942
}
943943
putParam("expand_wildcards", expandWildcards);
944+
putParam("ignore_throttled", Boolean.toString(indicesOptions.ignoreThrottled()));
944945
}
945946
return this;
946947
}

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ public void testFieldCaps() {
15361536
endpoint.add("_field_caps");
15371537

15381538
assertEquals(endpoint.toString(), request.getEndpoint());
1539-
assertEquals(4, request.getParameters().size());
1539+
assertEquals(5, request.getParameters().size());
15401540

15411541
// Note that we don't check the field param value explicitly, as field names are
15421542
// passed through
@@ -1570,7 +1570,7 @@ public void testRankEval() throws Exception {
15701570
}
15711571
endpoint.add(RestRankEvalAction.ENDPOINT);
15721572
assertEquals(endpoint.toString(), request.getEndpoint());
1573-
assertEquals(3, request.getParameters().size());
1573+
assertEquals(4, request.getParameters().size());
15741574
assertEquals(expectedParams, request.getParameters());
15751575
assertToXContentBody(spec, request.getEntity());
15761576
}
@@ -1897,7 +1897,8 @@ static void setRandomIndicesOptions(Consumer<IndicesOptions> setter, Supplier<In
18971897
Map<String, String> expectedParams) {
18981898

18991899
if (randomBoolean()) {
1900-
setter.accept(IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean()));
1900+
setter.accept(IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(),
1901+
true, false, false, randomBoolean()));
19011902
}
19021903
expectedParams.put("ignore_unavailable", Boolean.toString(getter.get().ignoreUnavailable()));
19031904
expectedParams.put("allow_no_indices", Boolean.toString(getter.get().allowNoIndices()));
@@ -1910,11 +1911,13 @@ static void setRandomIndicesOptions(Consumer<IndicesOptions> setter, Supplier<In
19101911
} else {
19111912
expectedParams.put("expand_wildcards", "none");
19121913
}
1914+
expectedParams.put("ignore_throttled", Boolean.toString(getter.get().ignoreThrottled()));
19131915
}
19141916

19151917
static IndicesOptions setRandomIndicesOptions(IndicesOptions indicesOptions, Map<String, String> expectedParams) {
19161918
if (randomBoolean()) {
1917-
indicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean());
1919+
indicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(),
1920+
true, false, false, randomBoolean());
19181921
}
19191922
expectedParams.put("ignore_unavailable", Boolean.toString(indicesOptions.ignoreUnavailable()));
19201923
expectedParams.put("allow_no_indices", Boolean.toString(indicesOptions.allowNoIndices()));
@@ -1927,6 +1930,7 @@ static IndicesOptions setRandomIndicesOptions(IndicesOptions indicesOptions, Map
19271930
} else {
19281931
expectedParams.put("expand_wildcards", "none");
19291932
}
1933+
expectedParams.put("ignore_throttled", Boolean.toString(indicesOptions.ignoreThrottled()));
19301934
return indicesOptions;
19311935
}
19321936

0 commit comments

Comments
 (0)