protected RestChannelConsumer doPrepareRequest(RestRequest request, NodeClient client, boolean includeCreated, boolean includeUpdated) throws IOException { // Build the internal request Request internal = setCommonOptions(request, buildRequest(request)); // Executes the request and waits for completion if (request.paramAsBoolean("wait_for_completion", true)) { Map<String, String> params = new HashMap<>(); params.put(BulkByScrollTask.Status.INCLUDE_CREATED, Boolean.toString(includeCreated)); params.put(BulkByScrollTask.Status.INCLUDE_UPDATED, Boolean.toString(includeUpdated)); return channel -> client.executeLocally(action, internal, new BulkIndexByScrollResponseContentListener(channel, params)); } else { internal.setShouldStoreResult(true); } /* * Let's try and validate before forking so the user gets some error. The * task can't totally validate until it starts but this is better than * nothing. */ ActionRequestValidationException validationException = internal.validate(); if (validationException != null) { throw validationException; } return sendTask(client.getLocalNodeId(), client.executeLocally(action, internal, LoggingTaskListener.instance())); }
return; Task task = action.execute(internalRequest, LoggingTaskListener.<Response>instance()); sendTask(channel, task);
return; Task task = action.execute(internalRequest, LoggingTaskListener.<Response>instance()); sendTask(channel, task);