Skip to content

Commit

Permalink
Added param ignore_throttled=false when indicesOptions.ignoreThrottle…
Browse files Browse the repository at this point in the history
…d() is false (#42393)

and fixed test RequestConvertersTests and added ignore_throttled on all request
  • Loading branch information
kfuksman authored and martijnvg committed May 29, 2019
1 parent 728c5d1 commit f0bfdef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ Params withIndicesOptions(IndicesOptions indicesOptions) {
expandWildcards = joiner.toString();
}
putParam("expand_wildcards", expandWildcards);
putParam("ignore_throttled", Boolean.toString(indicesOptions.ignoreThrottled()));
}
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ public void testFieldCaps() {
endpoint.add("_field_caps");

assertEquals(endpoint.toString(), request.getEndpoint());
assertEquals(4, request.getParameters().size());
assertEquals(5, request.getParameters().size());

// Note that we don't check the field param value explicitly, as field names are passed through
// a hash set before being added to the request, and can appear in a non-deterministic order.
Expand Down Expand Up @@ -1437,7 +1437,7 @@ public void testRankEval() throws Exception {
}
endpoint.add(RestRankEvalAction.ENDPOINT);
assertEquals(endpoint.toString(), request.getEndpoint());
assertEquals(3, request.getParameters().size());
assertEquals(4, request.getParameters().size());
assertEquals(expectedParams, request.getParameters());
assertToXContentBody(spec, request.getEntity());
}
Expand Down Expand Up @@ -1728,7 +1728,8 @@ static void setRandomIndicesOptions(Consumer<IndicesOptions> setter, Supplier<In
Map<String, String> expectedParams) {

if (randomBoolean()) {
setter.accept(IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean()));
setter.accept(IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(),
true, false, false, randomBoolean()));
}
expectedParams.put("ignore_unavailable", Boolean.toString(getter.get().ignoreUnavailable()));
expectedParams.put("allow_no_indices", Boolean.toString(getter.get().allowNoIndices()));
Expand All @@ -1741,11 +1742,13 @@ static void setRandomIndicesOptions(Consumer<IndicesOptions> setter, Supplier<In
} else {
expectedParams.put("expand_wildcards", "none");
}
expectedParams.put("ignore_throttled", Boolean.toString(getter.get().ignoreThrottled()));
}

static IndicesOptions setRandomIndicesOptions(IndicesOptions indicesOptions, Map<String, String> expectedParams) {
if (randomBoolean()) {
indicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean());
indicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(),
true, false, false, randomBoolean());
}
expectedParams.put("ignore_unavailable", Boolean.toString(indicesOptions.ignoreUnavailable()));
expectedParams.put("allow_no_indices", Boolean.toString(indicesOptions.allowNoIndices()));
Expand All @@ -1758,6 +1761,7 @@ static IndicesOptions setRandomIndicesOptions(IndicesOptions indicesOptions, Map
} else {
expectedParams.put("expand_wildcards", "none");
}
expectedParams.put("ignore_throttled", Boolean.toString(indicesOptions.ignoreThrottled()));
return indicesOptions;
}

Expand Down

0 comments on commit f0bfdef

Please sign in to comment.