diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartTransformAction.java index 07632fa0528..ca1b7a86c5a 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartTransformAction.java @@ -181,7 +181,7 @@ public class TransportStartTransformAction extends TransportMasterNodeAction Create the task in cluster state so that it will start executing on the node - ActionListener createOrGetIndexListener = ActionListener.wrap(unused -> { + ActionListener createOrGetIndexListener = ActionListener.wrap(unused -> { TransformTaskParams transformTask = transformTaskHolder.get(); assert transformTask != null; PersistentTasksCustomMetaData.PersistentTask existingTask = getExistingTask(transformTask.getId(), state); @@ -222,8 +222,10 @@ public class TransportStartTransformAction extends TransportMasterNodeAction { + auditor.info(request.getId(), "Created destination index [" + destinationIndex + "] with deduced mappings."); + createOrGetIndexListener.onResponse(r); + }, createOrGetIndexListener::onFailure)); } else { auditor.info(request.getId(), "Using existing destination index [" + destinationIndex + "]."); ClientHelper.executeAsyncWithOrigin( @@ -238,12 +240,12 @@ public class TransportStartTransformAction extends TransportMasterNodeAction { String msg = "Unable to determine destination index stats, error: " + e.getMessage(); - logger.error(msg, e); + logger.warn(msg, e); auditor.warning(request.getId(), msg); - createOrGetIndexListener.onResponse(null); + createOrGetIndexListener.onResponse(true); }), client.admin().indices()::stats ); @@ -265,9 +267,10 @@ public class TransportStartTransformAction extends TransportMasterNodeAction listener) { + private void createDestinationIndex(final TransformConfig config, final ActionListener listener) { final Pivot pivot = new Pivot(config.getPivotConfig()); ActionListener> deduceMappingsListener = ActionListener.wrap( - mappings -> TransformIndex.createDestinationIndex( - client, - Clock.systemUTC(), - config, - mappings, - ActionListener.wrap(r -> listener.onResponse(null), listener::onFailure) - ), + mappings -> TransformIndex.createDestinationIndex(client, Clock.systemUTC(), config, mappings, listener), deduceTargetMappingsException -> listener.onFailure( new RuntimeException(TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_DEDUCE_DEST_MAPPINGS, deduceTargetMappingsException) )