From 7c612af6d242729889551445455beb51903e7382 Mon Sep 17 00:00:00 2001 From: kevin fuksman Date: Wed, 29 May 2019 08:44:24 -0300 Subject: [PATCH] Added param ignore_throttled=false when indicesOptions.ignoreThrottled() is false (#42393) and fixed test RequestConvertersTests and added ignore_throttled on all request --- .../org/elasticsearch/client/RequestConverters.java | 1 + .../elasticsearch/client/RequestConvertersTests.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java index 023bd1fe63786..4a564b0279d02 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java @@ -939,6 +939,7 @@ Params withIndicesOptions(IndicesOptions indicesOptions) { expandWildcards = joiner.toString(); } putParam("expand_wildcards", expandWildcards); + putParam("ignore_throttled", Boolean.toString(indicesOptions.ignoreThrottled())); } return this; } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java index 09c57efceb5b1..498da6d5642f0 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java @@ -1567,7 +1567,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 @@ -1601,7 +1601,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()); } @@ -1928,7 +1928,8 @@ static void setRandomIndicesOptions(Consumer setter, Supplier 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())); @@ -1941,11 +1942,13 @@ static void setRandomIndicesOptions(Consumer setter, Supplier 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())); @@ -1958,6 +1961,7 @@ static IndicesOptions setRandomIndicesOptions(IndicesOptions indicesOptions, Map } else { expectedParams.put("expand_wildcards", "none"); } + expectedParams.put("ignore_throttled", Boolean.toString(indicesOptions.ignoreThrottled())); return indicesOptions; }