-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search/SearchSearch-related issues that do not fall into other categoriesSearch-related issues that do not fall into other categories>bugfeedback_neededv7.6.2v7.7.0v8.0.0-alpha1
Description
Elasticsearch version: 7.6.0
JVM version:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)
OS version: Windows 10
Description of the problem including expected versus actual behavior:
There is no way to specify auto-slice in an AbstractBulkByScrollRequest. AbstractBulkByScrollRequest.setSlices only takes an int but AbstractBaseReindexRestHandler.parseSlices checks for an 'auto' string, which is impossible provide via the Java High Level REST Client. Simply providing '0' instead does not work either as this causes parseSlices to throw an exception.
public static final int AUTO_SLICES = 0;
public static final String AUTO_SLICES_VALUE = "auto";
public Self setSlices(int slices) {
if (slices < 0) {
throw new IllegalArgumentException("[slices] must be at least 0 but was [" + slices + "]");
}
this.slices = slices;
return self();
}
private static Integer parseSlices(RestRequest request) {
String slicesString = request.param("slices");
if (slicesString == null) {
return null;
}
if (slicesString.equals(AbstractBulkByScrollRequest.AUTO_SLICES_VALUE)) {
return AbstractBulkByScrollRequest.AUTO_SLICES;
}
int slices;
try {
slices = Integer.parseInt(slicesString);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(
"[slices] must be a positive integer or the string \"auto\", but was [" + slicesString + "]", e);
}
if (slices < 1) {
throw new IllegalArgumentException(
"[slices] must be a positive integer or the string \"auto\", but was [" + slicesString + "]");
}
return slices;
}
Steps to reproduce:
UpdateByQueryRequest request = new UpdateByQueryRequest(index)
request.setSlices("auto")// does not work due to being string
UpdateByQueryRequest request = new UpdateByQueryRequest(index)
request.setSlices(0)// does not work due to being less than 1
Metadata
Metadata
Assignees
Labels
:Search/SearchSearch-related issues that do not fall into other categoriesSearch-related issues that do not fall into other categories>bugfeedback_neededv7.6.2v7.7.0v8.0.0-alpha1