diff --git a/docs/reference/settings/data-frames-settings.asciidoc b/docs/reference/settings/data-frames-settings.asciidoc index dc000fc414fca..bd212a4fbb246 100644 --- a/docs/reference/settings/data-frames-settings.asciidoc +++ b/docs/reference/settings/data-frames-settings.asciidoc @@ -20,7 +20,7 @@ file. [[general-data-frames-settings]] ==== General {transforms} settings -`xpack.data_frame.enabled`:: +`xpack.transform.enabled`:: Set to `true` (default) to enable {transforms} on the node. + + If set to `false` in `elasticsearch.yml`, the {transform} APIs are disabled on the node. @@ -28,10 +28,10 @@ Therefore the node cannot start or administrate {transform} or receive transport communication requests related to {transform} APIs. + IMPORTANT: If you want to use {transform} features in your cluster, you must have -`xpack.data_frame.enabled` set to `true` on all master-eligible nodes. This is the +`xpack.transform.enabled` set to `true` on all master-eligible nodes. This is the default behavior. -`xpack.data_frame.num_transform_failure_retries` (<>):: +`xpack.transform.num_transform_failure_retries` (<>):: The number of times that a {transform} retries when it experiences a non-fatal error. Once the number of retries is exhausted, the {transform} task will be marked as `failed`. The default value is `10` with a valid minimum of `0` diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java index 394da4937c200..86c7611bfee20 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java @@ -598,7 +598,7 @@ public static boolean isMachineLearningAllowedForOperationMode(final OperationMo * * @return true if the license is active */ - public synchronized boolean isDataFrameAllowed() { + public synchronized boolean isTransformAllowed() { return status.active; } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ClientHelper.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ClientHelper.java index ec4fc7a87adcf..4de7c51f8daac 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ClientHelper.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ClientHelper.java @@ -50,7 +50,7 @@ public final class ClientHelper { public static final String DEPRECATION_ORIGIN = "deprecation"; public static final String PERSISTENT_TASK_ORIGIN = "persistent_tasks"; public static final String ROLLUP_ORIGIN = "rollup"; - public static final String DATA_FRAME_ORIGIN = "data_frame"; + public static final String TRANSFORM_ORIGIN = "transform"; private ClientHelper() {} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java index 2dc7caeb20498..9f403953eb175 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java @@ -199,7 +199,7 @@ import org.elasticsearch.xpack.core.transform.action.PutTransformAction; import org.elasticsearch.xpack.core.transform.action.StartTransformAction; import org.elasticsearch.xpack.core.transform.action.StopTransformAction; -import org.elasticsearch.xpack.core.transform.transforms.Transform; +import org.elasticsearch.xpack.core.transform.transforms.TransformTaskParams; import org.elasticsearch.xpack.core.transform.transforms.TransformState; import org.elasticsearch.xpack.core.transform.transforms.SyncConfig; import org.elasticsearch.xpack.core.transform.transforms.TimeSyncConfig; @@ -497,8 +497,8 @@ public List getNamedWriteables() { new NamedWriteableRegistry.Entry(LifecycleAction.class, SetPriorityAction.NAME, SetPriorityAction::new), new NamedWriteableRegistry.Entry(LifecycleAction.class, UnfollowAction.NAME, UnfollowAction::new), // Data Frame - new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.Transform, TransformFeatureSetUsage::new), - new NamedWriteableRegistry.Entry(PersistentTaskParams.class, TransformField.TASK_NAME, Transform::new), + new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.TRANSFORM, TransformFeatureSetUsage::new), + new NamedWriteableRegistry.Entry(PersistentTaskParams.class, TransformField.TASK_NAME, TransformTaskParams::new), new NamedWriteableRegistry.Entry(Task.Status.class, TransformField.TASK_NAME, TransformState::new), new NamedWriteableRegistry.Entry(PersistentTaskState.class, TransformField.TASK_NAME, TransformState::new), new NamedWriteableRegistry.Entry(SyncConfig.class, TransformField.TIME_BASED_SYNC.getPreferredName(), TimeSyncConfig::new), @@ -549,7 +549,7 @@ public List getNamedXContent() { RollupJobStatus::fromXContent), // Data Frame new NamedXContentRegistry.Entry(PersistentTaskParams.class, new ParseField(TransformField.TASK_NAME), - Transform::fromXContent), + TransformTaskParams::fromXContent), new NamedXContentRegistry.Entry(Task.Status.class, new ParseField(TransformField.TASK_NAME), TransformState::fromXContent), new NamedXContentRegistry.Entry(PersistentTaskState.class, new ParseField(TransformField.TASK_NAME), diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackField.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackField.java index 1dde1c5ca7259..530ed89f68864 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackField.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackField.java @@ -36,7 +36,7 @@ public final class XPackField { /** Name constant for the CCR feature. */ public static final String CCR = "ccr"; /** Name constant for the transform feature. */ - public static final String Transform = "transform"; + public static final String TRANSFORM = "transform"; /** Name constant for flattened fields. */ public static final String FLATTENED = "flattened"; /** Name constant for the vectors feature. */ diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java index 70e6aebd15db5..b40307ac21db2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java @@ -41,7 +41,7 @@ private XPackSettings() { public static final Setting CCR_ENABLED_SETTING = Setting.boolSetting("xpack.ccr.enabled", true, Property.NodeScope); /** Setting for enabling or disabling data frame. Defaults to true. */ - public static final Setting DATA_FRAME_ENABLED = Setting.boolSetting("xpack.data_frame.enabled", true, + public static final Setting TRANSFORM_ENABLED = Setting.boolSetting("xpack.transform.enabled", true, Setting.Property.NodeScope); /** Setting for enabling or disabling security. Defaults to true. */ @@ -217,7 +217,7 @@ public static List> getAllSettings() { settings.add(PASSWORD_HASHING_ALGORITHM); settings.add(INDEX_LIFECYCLE_ENABLED); settings.add(SNAPSHOT_LIFECYCLE_ENABLED); - settings.add(DATA_FRAME_ENABLED); + settings.add(TRANSFORM_ENABLED); settings.add(FLATTENED_ENABLED); settings.add(VECTORS_ENABLED); return Collections.unmodifiableList(settings); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackInfoFeatureAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackInfoFeatureAction.java index 934aac1064ce0..084f5c0843d49 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackInfoFeatureAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackInfoFeatureAction.java @@ -32,7 +32,7 @@ public class XPackInfoFeatureAction extends ActionType public static final XPackInfoFeatureAction ROLLUP = new XPackInfoFeatureAction(XPackField.ROLLUP); public static final XPackInfoFeatureAction INDEX_LIFECYCLE = new XPackInfoFeatureAction(XPackField.INDEX_LIFECYCLE); public static final XPackInfoFeatureAction CCR = new XPackInfoFeatureAction(XPackField.CCR); - public static final XPackInfoFeatureAction DATA_FRAME = new XPackInfoFeatureAction(XPackField.Transform); + public static final XPackInfoFeatureAction TRANSFORM = new XPackInfoFeatureAction(XPackField.TRANSFORM); public static final XPackInfoFeatureAction FLATTENED = new XPackInfoFeatureAction(XPackField.FLATTENED); public static final XPackInfoFeatureAction VECTORS = new XPackInfoFeatureAction(XPackField.VECTORS); public static final XPackInfoFeatureAction VOTING_ONLY = new XPackInfoFeatureAction(XPackField.VOTING_ONLY); @@ -41,7 +41,7 @@ public class XPackInfoFeatureAction extends ActionType public static final XPackInfoFeatureAction ANALYTICS = new XPackInfoFeatureAction(XPackField.ANALYTICS); public static final List ALL = Arrays.asList( - SECURITY, MONITORING, WATCHER, GRAPH, MACHINE_LEARNING, LOGSTASH, SQL, ROLLUP, INDEX_LIFECYCLE, CCR, DATA_FRAME, FLATTENED, + SECURITY, MONITORING, WATCHER, GRAPH, MACHINE_LEARNING, LOGSTASH, SQL, ROLLUP, INDEX_LIFECYCLE, CCR, TRANSFORM, FLATTENED, VECTORS, VOTING_ONLY, FROZEN_INDICES, SPATIAL, ANALYTICS ); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageFeatureAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageFeatureAction.java index 49b1545be56e2..14c7f5ff58391 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageFeatureAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageFeatureAction.java @@ -32,7 +32,7 @@ public class XPackUsageFeatureAction extends ActionType ALL = Arrays.asList( - SECURITY, MONITORING, WATCHER, GRAPH, MACHINE_LEARNING, LOGSTASH, SQL, ROLLUP, INDEX_LIFECYCLE, CCR, DATA_FRAME, FLATTENED, + SECURITY, MONITORING, WATCHER, GRAPH, MACHINE_LEARNING, LOGSTASH, SQL, ROLLUP, INDEX_LIFECYCLE, CCR, TRANSFORM, FLATTENED, VECTORS, VOTING_ONLY, FROZEN_INDICES, SPATIAL, ANALYTICS ); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformFeatureSetUsage.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformFeatureSetUsage.java index d7f70485f67d5..2cd3864f673bd 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformFeatureSetUsage.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformFeatureSetUsage.java @@ -32,7 +32,7 @@ public TransformFeatureSetUsage(StreamInput in) throws IOException { public TransformFeatureSetUsage(boolean available, boolean enabled, Map transformCountByState, TransformIndexerStats accumulatedStats) { - super(XPackField.Transform, available, enabled); + super(XPackField.TRANSFORM, available, enabled); this.transformCountByState = Objects.requireNonNull(transformCountByState); this.accumulatedStats = Objects.requireNonNull(accumulatedStats); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformField.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformField.java index 54abc9799e354..3e09577de4c3e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformField.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformField.java @@ -65,12 +65,12 @@ public final class TransformField { public static final String PERSISTENT_TASK_DESCRIPTION_PREFIX = "data_frame_"; // strings for meta information - public static final String META_FIELDNAME = "_data_frame"; + public static final String META_FIELDNAME = "_transform"; public static final String CREATION_DATE_MILLIS = "creation_date_in_millis"; public static final String CREATED = "created"; public static final String CREATED_BY = "created_by"; public static final String TRANSFORM = "transform"; - public static final String DATA_FRAME_SIGNATURE = "data-frame-transform"; + public static final String TRANSFORM_SIGNATURE = "transform"; /** * Parameter to indicate whether we are serialising to X Content for internal storage. Default the field is invisible (e.g. for get diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformMessages.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformMessages.java index 4f14a3f4e650d..3bd18e1c28353 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformMessages.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformMessages.java @@ -12,67 +12,67 @@ public class TransformMessages { public static final String REST_STOP_TRANSFORM_WAIT_FOR_COMPLETION_TIMEOUT = - "Timed out after [{0}] while waiting for data frame transform [{1}] to stop"; + "Timed out after [{0}] while waiting for transform [{1}] to stop"; public static final String REST_STOP_TRANSFORM_WAIT_FOR_COMPLETION_INTERRUPT = - "Interrupted while waiting for data frame transform [{0}] to stop"; - public static final String REST_PUT_DATA_FRAME_TRANSFORM_EXISTS = "Transform with id [{0}] already exists"; - public static final String REST_DATA_FRAME_UNKNOWN_TRANSFORM = "Transform with id [{0}] could not be found"; - public static final String REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION = - "Failed to validate data frame configuration"; - public static final String REST_PUT_DATA_FRAME_FAILED_PERSIST_TRANSFORM_CONFIGURATION = "Failed to persist data frame configuration"; - public static final String REST_PUT_DATA_FRAME_FAILED_TO_DEDUCE_DEST_MAPPINGS = "Failed to deduce dest mappings"; - public static final String REST_PUT_DATA_FRAME_SOURCE_INDEX_MISSING = "Source index [{0}] does not exist"; - public static final String REST_PUT_DATA_FRAME_DEST_IN_SOURCE = "Destination index [{0}] is included in source expression [{1}]"; - public static final String REST_PUT_DATA_FRAME_DEST_SINGLE_INDEX = "Destination index [{0}] should refer to a single index"; - public static final String REST_PUT_DATA_FRAME_INCONSISTENT_ID = + "Interrupted while waiting for transform [{0}] to stop"; + public static final String REST_PUT_TRANSFORM_EXISTS = "Transform with id [{0}] already exists"; + public static final String REST_UNKNOWN_TRANSFORM = "Transform with id [{0}] could not be found"; + public static final String REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION = + "Failed to validate configuration"; + public static final String REST_PUT_FAILED_PERSIST_TRANSFORM_CONFIGURATION = "Failed to persist transform configuration"; + public static final String REST_PUT_TRANSFORM_FAILED_TO_DEDUCE_DEST_MAPPINGS = "Failed to deduce dest mappings"; + public static final String REST_PUT_TRANSFORM_SOURCE_INDEX_MISSING = "Source index [{0}] does not exist"; + public static final String REST_PUT_TRANSFORM_DEST_IN_SOURCE = "Destination index [{0}] is included in source expression [{1}]"; + public static final String REST_PUT_TRANSFORM_DEST_SINGLE_INDEX = "Destination index [{0}] should refer to a single index"; + public static final String REST_PUT_TRANSFORM_INCONSISTENT_ID = "Inconsistent id; ''{0}'' specified in the body differs from ''{1}'' specified as a URL argument"; - public static final String DATA_FRAME_CONFIG_INVALID = "Data frame transform configuration is invalid [{0}]"; - public static final String REST_DATA_FRAME_FAILED_TO_SERIALIZE_TRANSFORM = "Failed to serialise transform [{0}]"; - public static final String DATA_FRAME_FAILED_TO_PERSIST_STATS = "Failed to persist data frame statistics for transform [{0}]"; - public static final String DATA_FRAME_UNKNOWN_TRANSFORM_STATS = "Statistics for transform [{0}] could not be found"; + public static final String TRANSFORM_CONFIG_INVALID = "Transform configuration is invalid [{0}]"; + public static final String REST_FAILED_TO_SERIALIZE_TRANSFORM = "Failed to serialise transform [{0}]"; + public static final String TRANSFORM_FAILED_TO_PERSIST_STATS = "Failed to persist transform statistics for transform [{0}]"; + public static final String UNKNOWN_TRANSFORM_STATS = "Statistics for transform [{0}] could not be found"; - public static final String DATA_FRAME_CANNOT_STOP_FAILED_TRANSFORM = - "Unable to stop data frame transform [{0}] as it is in a failed state with reason [{1}]." + - " Use force stop to stop the data frame transform."; - public static final String DATA_FRAME_CANNOT_START_FAILED_TRANSFORM = - "Unable to start data frame transform [{0}] as it is in a failed state with failure: [{1}]. " + - "Use force stop and then restart the data frame transform once error is resolved."; + public static final String CANNOT_STOP_FAILED_TRANSFORM = + "Unable to stop transform [{0}] as it is in a failed state with reason [{1}]." + + " Use force stop to stop the transform."; + public static final String CANNOT_START_FAILED_TRANSFORM = + "Unable to start transform [{0}] as it is in a failed state with failure: [{1}]. " + + "Use force stop and then restart the transform once error is resolved."; public static final String FAILED_TO_CREATE_DESTINATION_INDEX = "Could not create destination index [{0}] for transform [{1}]"; public static final String FAILED_TO_RELOAD_TRANSFORM_CONFIGURATION = - "Failed to reload data frame transform configuration for transform [{0}]"; + "Failed to reload transform configuration for transform [{0}]"; public static final String FAILED_TO_LOAD_TRANSFORM_CONFIGURATION = - "Failed to load data frame transform configuration for transform [{0}]"; + "Failed to load transform configuration for transform [{0}]"; public static final String FAILED_TO_PARSE_TRANSFORM_CONFIGURATION = - "Failed to parse transform configuration for data frame transform [{0}]"; + "Failed to parse transform configuration for transform [{0}]"; public static final String FAILED_TO_PARSE_TRANSFORM_STATISTICS_CONFIGURATION = - "Failed to parse transform statistics for data frame transform [{0}]"; + "Failed to parse transform statistics for transform [{0}]"; public static final String FAILED_TO_LOAD_TRANSFORM_CHECKPOINT = - "Failed to load data frame transform checkpoint for transform [{0}]"; + "Failed to load transform checkpoint for transform [{0}]"; public static final String FAILED_TO_LOAD_TRANSFORM_STATE = - "Failed to load data frame transform state for transform [{0}]"; - public static final String DATA_FRAME_TRANSFORM_CONFIGURATION_NO_TRANSFORM = - "Data frame transform configuration must specify exactly 1 function"; - public static final String DATA_FRAME_TRANSFORM_CONFIGURATION_PIVOT_NO_GROUP_BY = - "Data frame pivot transform configuration must specify at least 1 group_by"; - public static final String DATA_FRAME_TRANSFORM_CONFIGURATION_PIVOT_NO_AGGREGATION = - "Data frame pivot transform configuration must specify at least 1 aggregation"; - public static final String DATA_FRAME_TRANSFORM_PIVOT_FAILED_TO_CREATE_COMPOSITE_AGGREGATION = + "Failed to load transform state for transform [{0}]"; + public static final String TRANSFORM_CONFIGURATION_NO_TRANSFORM = + "Transform configuration must specify exactly 1 function"; + public static final String TRANSFORM_CONFIGURATION_PIVOT_NO_GROUP_BY = + "Pivot transform configuration must specify at least 1 group_by"; + public static final String TRANSFORM_CONFIGURATION_PIVOT_NO_AGGREGATION = + "Pivot transform configuration must specify at least 1 aggregation"; + public static final String TRANSFORM_PIVOT_FAILED_TO_CREATE_COMPOSITE_AGGREGATION = "Failed to create composite aggregation from pivot function"; - public static final String DATA_FRAME_TRANSFORM_CONFIGURATION_INVALID = - "Data frame transform configuration [{0}] has invalid elements"; - public static final String DATA_FRAME_UNABLE_TO_GATHER_FIELD_MAPPINGS = "Failed to gather field mappings for index [{0}]"; - public static final String DATA_FRAME_UPDATE_CANNOT_CHANGE_SYNC_METHOD = + public static final String TRANSFORM_CONFIGURATION_INVALID = + "Transform configuration [{0}] has invalid elements"; + public static final String UNABLE_TO_GATHER_FIELD_MAPPINGS = "Failed to gather field mappings for index [{0}]"; + public static final String TRANSFORM_UPDATE_CANNOT_CHANGE_SYNC_METHOD = "Cannot change the current sync configuration of transform [{0}] from [{1}] to [{2}]"; - public static final String LOG_DATA_FRAME_TRANSFORM_CONFIGURATION_BAD_QUERY = - "Failed to parse query for data frame transform"; - public static final String LOG_DATA_FRAME_TRANSFORM_CONFIGURATION_BAD_GROUP_BY = - "Failed to parse group_by for data frame pivot transform"; - public static final String LOG_DATA_FRAME_TRANSFORM_CONFIGURATION_BAD_AGGREGATION = - "Failed to parse aggregation for data frame pivot transform"; - public static final String LOG_DATA_FRAME_TRANSFORM_PIVOT_REDUCE_PAGE_SIZE = + public static final String LOG_TRANSFORM_CONFIGURATION_BAD_QUERY = + "Failed to parse query for transform"; + public static final String LOG_TRANSFORM_CONFIGURATION_BAD_GROUP_BY = + "Failed to parse group_by for pivot transform"; + public static final String LOG_TRANSFORM_CONFIGURATION_BAD_AGGREGATION = + "Failed to parse aggregation for pivot transform"; + public static final String LOG_TRANSFORM_PIVOT_REDUCE_PAGE_SIZE = "Insufficient memory for search, reducing number of buckets per search from [{0}] to [{1}]"; - public static final String LOG_DATA_FRAME_TRANSFORM_PIVOT_LOW_PAGE_SIZE_FAILURE = + public static final String LOG_TRANSFORM_PIVOT_LOW_PAGE_SIZE_FAILURE = "Insufficient memory for search after repeated page size reductions to [{0}], unable to continue pivot, " + "please simplify job or increase heap size on data nodes."; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/QueryConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/QueryConfig.java index c2138fbcb772e..e65867c03e4b2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/QueryConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/QueryConfig.java @@ -85,7 +85,7 @@ public static QueryConfig fromXContent(final XContentParser parser, boolean leni query = AbstractQueryBuilder.parseInnerQueryBuilder(sourceParser); } catch (Exception e) { if (lenient) { - logger.warn(TransformMessages.LOG_DATA_FRAME_TRANSFORM_CONFIGURATION_BAD_QUERY, e); + logger.warn(TransformMessages.LOG_TRANSFORM_CONFIGURATION_BAD_QUERY, e); } else { throw e; } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java index 62930a3a3b3ca..1d2294e53b9d0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java @@ -81,7 +81,7 @@ private static ConstructingObjectParser createParser(bo id = optionalId; } else if (optionalId != null && id.equals(optionalId) == false) { throw new IllegalArgumentException( - TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_INCONSISTENT_ID, id, optionalId)); + TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_INCONSISTENT_ID, id, optionalId)); } SourceConfig source = (SourceConfig) args[1]; @@ -169,7 +169,7 @@ public static String documentId(String transformId) { // at least one function must be defined if (this.pivotConfig == null) { - throw new IllegalArgumentException(TransformMessages.DATA_FRAME_TRANSFORM_CONFIGURATION_NO_TRANSFORM); + throw new IllegalArgumentException(TransformMessages.TRANSFORM_CONFIGURATION_NO_TRANSFORM); } if (this.description != null && this.description.length() > MAX_DESCRIPTION_LENGTH) { throw new IllegalArgumentException("[description] must be less than 1000 characters in length."); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java index 17e01417dcb70..2916be95a2270 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java @@ -235,7 +235,7 @@ public TransformConfig apply(TransformConfig config) { String currentConfigName = config.getSyncConfig() == null ? "null" : config.getSyncConfig().getWriteableName(); if (syncConfig.getWriteableName().equals(currentConfigName) == false) { throw new ElasticsearchStatusException( - TransformMessages.getMessage(TransformMessages.DATA_FRAME_UPDATE_CANNOT_CHANGE_SYNC_METHOD, + TransformMessages.getMessage(TransformMessages.TRANSFORM_UPDATE_CANNOT_CHANGE_SYNC_METHOD, config.getId(), currentConfigName, syncConfig.getWriteableName()), diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/Transform.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformTaskParams.java similarity index 84% rename from x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/Transform.java rename to x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformTaskParams.java index 22d1385f59e37..ea5d97e049e08 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/Transform.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformTaskParams.java @@ -21,7 +21,7 @@ import java.io.IOException; import java.util.Objects; -public class Transform extends AbstractDiffable implements PersistentTaskParams { +public class TransformTaskParams extends AbstractDiffable implements PersistentTaskParams { public static final String NAME = TransformField.TASK_NAME; public static final ParseField FREQUENCY = TransformField.FREQUENCY; @@ -30,8 +30,8 @@ public class Transform extends AbstractDiffable implements Persistent private final Version version; private final TimeValue frequency; - public static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(NAME, true, - a -> new Transform((String) a[0], (String) a[1], (String) a[2])); + public static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(NAME, true, + a -> new TransformTaskParams((String) a[0], (String) a[1], (String) a[2])); static { PARSER.declareString(ConstructingObjectParser.constructorArg(), TransformField.ID); @@ -39,18 +39,18 @@ public class Transform extends AbstractDiffable implements Persistent PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), FREQUENCY); } - private Transform(String transformId, String version, String frequency) { + private TransformTaskParams(String transformId, String version, String frequency) { this(transformId, version == null ? null : Version.fromString(version), frequency == null ? null : TimeValue.parseTimeValue(frequency, FREQUENCY.getPreferredName())); } - public Transform(String transformId, Version version, TimeValue frequency) { + public TransformTaskParams(String transformId, Version version, TimeValue frequency) { this.transformId = transformId; this.version = version == null ? Version.V_7_2_0 : version; this.frequency = frequency; } - public Transform(StreamInput in) throws IOException { + public TransformTaskParams(StreamInput in) throws IOException { this.transformId = in.readString(); if (in.getVersion().onOrAfter(Version.V_7_3_0)) { this.version = Version.readVersion(in); @@ -109,7 +109,7 @@ public TimeValue getFrequency() { return frequency; } - public static Transform fromXContent(XContentParser parser) throws IOException { + public static TransformTaskParams fromXContent(XContentParser parser) throws IOException { return PARSER.parse(parser, null); } @@ -123,7 +123,7 @@ public boolean equals(Object other) { return false; } - Transform that = (Transform) other; + TransformTaskParams that = (TransformTaskParams) other; return Objects.equals(this.transformId, that.transformId) && Objects.equals(this.version, that.version) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/AggregationConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/AggregationConfig.java index 1a7ef1c48afda..6617eae7ea6b8 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/AggregationConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/AggregationConfig.java @@ -78,9 +78,9 @@ public static AggregationConfig fromXContent(final XContentParser parser, boolea if (source.isEmpty()) { if (lenient) { - logger.warn(TransformMessages.DATA_FRAME_TRANSFORM_CONFIGURATION_PIVOT_NO_AGGREGATION); + logger.warn(TransformMessages.TRANSFORM_CONFIGURATION_PIVOT_NO_AGGREGATION); } else { - throw new IllegalArgumentException(TransformMessages.DATA_FRAME_TRANSFORM_CONFIGURATION_PIVOT_NO_AGGREGATION); + throw new IllegalArgumentException(TransformMessages.TRANSFORM_CONFIGURATION_PIVOT_NO_AGGREGATION); } } else { try (XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().map(source); @@ -90,7 +90,7 @@ public static AggregationConfig fromXContent(final XContentParser parser, boolea aggregations = AggregatorFactories.parseAggregators(sourceParser); } catch (Exception e) { if (lenient) { - logger.warn(TransformMessages.LOG_DATA_FRAME_TRANSFORM_CONFIGURATION_BAD_AGGREGATION, e); + logger.warn(TransformMessages.LOG_TRANSFORM_CONFIGURATION_BAD_AGGREGATION, e); } else { throw e; } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/GroupConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/GroupConfig.java index 6e8c03b83663d..e97315edc4953 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/GroupConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/pivot/GroupConfig.java @@ -115,9 +115,9 @@ public static GroupConfig fromXContent(final XContentParser parser, boolean leni if (source.isEmpty()) { if (lenient) { - logger.warn(TransformMessages.DATA_FRAME_TRANSFORM_CONFIGURATION_PIVOT_NO_GROUP_BY); + logger.warn(TransformMessages.TRANSFORM_CONFIGURATION_PIVOT_NO_GROUP_BY); } else { - throw new IllegalArgumentException(TransformMessages.DATA_FRAME_TRANSFORM_CONFIGURATION_PIVOT_NO_GROUP_BY); + throw new IllegalArgumentException(TransformMessages.TRANSFORM_CONFIGURATION_PIVOT_NO_GROUP_BY); } } else { try (XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().map(source); @@ -126,7 +126,7 @@ public static GroupConfig fromXContent(final XContentParser parser, boolean leni groups = parseGroupConfig(sourceParser, lenient); } catch (Exception e) { if (lenient) { - logger.warn(TransformMessages.LOG_DATA_FRAME_TRANSFORM_CONFIGURATION_BAD_GROUP_BY, e); + logger.warn(TransformMessages.LOG_TRANSFORM_CONFIGURATION_BAD_GROUP_BY, e); } else { throw e; } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/TransformMessagesTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/TransformMessagesTests.java index f730fe577e52a..c994a1dadb1a7 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/TransformMessagesTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/TransformMessagesTests.java @@ -19,7 +19,7 @@ public class TransformMessagesTests extends ESTestCase { public void testGetMessage_WithFormatStrings() { String formattedMessage = TransformMessages.getMessage(TransformMessages.REST_STOP_TRANSFORM_WAIT_FOR_COMPLETION_TIMEOUT, "30s", "my_transform"); - assertEquals("Timed out after [30s] while waiting for data frame transform [my_transform] to stop", formattedMessage); + assertEquals("Timed out after [30s] while waiting for transform [my_transform] to stop", formattedMessage); } public void testMessageProperFormat() throws IllegalArgumentException, IllegalAccessException { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/GetTransformsActionResponseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/GetTransformsActionResponseTests.java index 16b3a413bfa82..8c274e2822dd1 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/GetTransformsActionResponseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/GetTransformsActionResponseTests.java @@ -27,9 +27,9 @@ public class GetTransformsActionResponseTests extends AbstractWireSerializingTra public void testInvalidTransforms() throws IOException { List transforms = new ArrayList<>(); - transforms.add(TransformConfigTests.randomDataFrameTransformConfig()); + transforms.add(TransformConfigTests.randomTransformConfig()); transforms.add(TransformConfigTests.randomInvalidDataFrameTransformConfig()); - transforms.add(TransformConfigTests.randomDataFrameTransformConfig()); + transforms.add(TransformConfigTests.randomTransformConfig()); transforms.add(TransformConfigTests.randomInvalidDataFrameTransformConfig()); Response r = new Response(transforms, transforms.size()); @@ -49,7 +49,7 @@ public void testNoHeaderInResponse() throws IOException { List transforms = new ArrayList<>(); for (int i = 0; i < randomIntBetween(1, 10); ++i) { - transforms.add(TransformConfigTests.randomDataFrameTransformConfig()); + transforms.add(TransformConfigTests.randomTransformConfig()); } Response r = new Response(transforms, transforms.size()); @@ -73,7 +73,7 @@ public void testNoHeaderInResponse() throws IOException { protected Response createTestInstance() { List configs = new ArrayList<>(); for (int i = 0; i < randomInt(10); ++i) { - configs.add(TransformConfigTests.randomDataFrameTransformConfig()); + configs.add(TransformConfigTests.randomTransformConfig()); } return new Response(configs, randomNonNegativeLong()); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformCheckpointStatsTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformCheckpointStatsTests.java index e8f2b48922701..8039758b3735f 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformCheckpointStatsTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformCheckpointStatsTests.java @@ -15,8 +15,8 @@ public class TransformCheckpointStatsTests extends AbstractSerializingTransformT { public static TransformCheckpointStats randomDataFrameTransformCheckpointStats() { return new TransformCheckpointStats(randomLongBetween(1, 1_000_000), - TransformIndexerPositionTests.randomDataFrameIndexerPosition(), - randomBoolean() ? null : TransformProgressTests.randomDataFrameTransformProgress(), + TransformIndexerPositionTests.randomTransformIndexerPosition(), + randomBoolean() ? null : TransformProgressTests.randomTransformProgress(), randomLongBetween(1, 1_000_000), randomLongBetween(0, 1_000_000)); } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformCheckpointTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformCheckpointTests.java index d4ca7470b5e0a..f70f6c68e0179 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformCheckpointTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformCheckpointTests.java @@ -22,7 +22,7 @@ public class TransformCheckpointTests extends AbstractSerializingTransformTestCase { - public static TransformCheckpoint randomDataFrameTransformCheckpoints() { + public static TransformCheckpoint randomTransformCheckpoints() { return new TransformCheckpoint(randomAlphaOfLengthBetween(1, 10), randomNonNegativeLong(), randomNonNegativeLong(), randomCheckpointsByIndex(), randomNonNegativeLong()); } @@ -34,7 +34,7 @@ protected TransformCheckpoint doParseInstance(XContentParser parser) throws IOEx @Override protected TransformCheckpoint createTestInstance() { - return randomDataFrameTransformCheckpoints(); + return randomTransformCheckpoints(); } @Override @@ -43,7 +43,7 @@ protected Reader instanceReader() { } public void testXContentForInternalStorage() throws IOException { - TransformCheckpoint dataFrameTransformCheckpoints = randomDataFrameTransformCheckpoints(); + TransformCheckpoint dataFrameTransformCheckpoints = randomTransformCheckpoints(); try (XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()) { XContentBuilder content = dataFrameTransformCheckpoints.toXContent(xContentBuilder, getToXContentParams()); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java index 4c70a67caf775..030f9c24ff526 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java @@ -39,8 +39,8 @@ public static TransformConfig randomDataFrameTransformConfigWithoutHeaders() { return randomDataFrameTransformConfigWithoutHeaders(randomAlphaOfLengthBetween(1, 10)); } - public static TransformConfig randomDataFrameTransformConfig() { - return randomDataFrameTransformConfig(randomAlphaOfLengthBetween(1, 10)); + public static TransformConfig randomTransformConfig() { + return randomTransformConfig(randomAlphaOfLengthBetween(1, 10)); } public static TransformConfig randomDataFrameTransformConfigWithoutHeaders(String id) { @@ -56,7 +56,7 @@ public static TransformConfig randomDataFrameTransformConfigWithoutHeaders(Strin null); } - public static TransformConfig randomDataFrameTransformConfig(String id) { + public static TransformConfig randomTransformConfig(String id) { return new TransformConfig(id, randomSourceConfig(), randomDestConfig(), @@ -101,7 +101,7 @@ protected TransformConfig doParseInstance(XContentParser parser) throws IOExcept @Override protected TransformConfig createTestInstance() { - return runWithHeaders ? randomDataFrameTransformConfig(transformId) : randomDataFrameTransformConfigWithoutHeaders(transformId); + return runWithHeaders ? randomTransformConfig(transformId) : randomDataFrameTransformConfigWithoutHeaders(transformId); } @Override @@ -213,7 +213,7 @@ public void testPreventVersionInjection() { } public void testXContentForInternalStorage() throws IOException { - TransformConfig dataFrameTransformConfig = randomDataFrameTransformConfig(); + TransformConfig dataFrameTransformConfig = randomTransformConfig(); try (XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()) { XContentBuilder content = dataFrameTransformConfig.toXContent(xContentBuilder, getToXContentParams()); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdateTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdateTests.java index 79de09018f665..b6ecff6bc5ddc 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdateTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdateTests.java @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.Map; -import static org.elasticsearch.xpack.core.transform.transforms.TransformConfigTests.randomDataFrameTransformConfig; +import static org.elasticsearch.xpack.core.transform.transforms.TransformConfigTests.randomTransformConfig; import static org.elasticsearch.xpack.core.transform.transforms.DestConfigTests.randomDestConfig; import static org.elasticsearch.xpack.core.transform.transforms.SourceConfigTests.randomSourceConfig; import static org.hamcrest.Matchers.equalTo; @@ -58,7 +58,7 @@ protected Reader instanceReader() { public void testIsNoop() { for (int i = 0; i < NUMBER_OF_TEST_RUNS; i++) { - TransformConfig config = randomDataFrameTransformConfig(); + TransformConfig config = randomTransformConfig(); TransformConfigUpdate update = new TransformConfigUpdate(null, null, null, null, null); assertTrue("null update is not noop", update.isNoop(config)); update = new TransformConfigUpdate(config.getSource(), diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformIndexerPositionTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformIndexerPositionTests.java index 3f875e35e16b1..770fd5756f763 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformIndexerPositionTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformIndexerPositionTests.java @@ -17,13 +17,13 @@ public class TransformIndexerPositionTests extends AbstractSerializingTestCase { - public static TransformIndexerPosition randomDataFrameIndexerPosition() { + public static TransformIndexerPosition randomTransformIndexerPosition() { return new TransformIndexerPosition(randomPosition(), randomPosition()); } @Override protected TransformIndexerPosition createTestInstance() { - return randomDataFrameIndexerPosition(); + return randomTransformIndexerPosition(); } @Override diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformProgressTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformProgressTests.java index 032df0c6d08a8..f8b79c6e9948b 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformProgressTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformProgressTests.java @@ -21,7 +21,7 @@ public class TransformProgressTests extends AbstractSerializingTransformTestCase { - public static TransformProgress randomDataFrameTransformProgress() { + public static TransformProgress randomTransformProgress() { return new TransformProgress( randomBoolean() ? null : randomLongBetween(0, 10000), randomBoolean() ? null : randomLongBetween(0, 10000), @@ -35,7 +35,7 @@ protected TransformProgress doParseInstance(XContentParser parser) throws IOExce @Override protected TransformProgress createTestInstance() { - return randomDataFrameTransformProgress(); + return randomTransformProgress(); } @Override diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformStateTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformStateTests.java index 7836505557541..3bd90944894a5 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformStateTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformStateTests.java @@ -14,7 +14,7 @@ import java.io.IOException; import java.util.function.Predicate; -import static org.elasticsearch.xpack.core.transform.transforms.TransformProgressTests.randomDataFrameTransformProgress; +import static org.elasticsearch.xpack.core.transform.transforms.TransformProgressTests.randomTransformProgress; import static org.elasticsearch.xpack.core.transform.transforms.NodeAttributeTests.randomNodeAttributes; public class TransformStateTests extends AbstractSerializingTestCase { @@ -22,10 +22,10 @@ public class TransformStateTests extends AbstractSerializingTestCase { +public class TransformTests extends AbstractSerializingTransformTestCase { @Override - protected Transform doParseInstance(XContentParser parser) throws IOException { - return Transform.PARSER.apply(parser, null); + protected TransformTaskParams doParseInstance(XContentParser parser) throws IOException { + return TransformTaskParams.PARSER.apply(parser, null); } @Override - protected Transform createTestInstance() { - return new Transform(randomAlphaOfLength(10), randomBoolean() ? null : Version.CURRENT, + protected TransformTaskParams createTestInstance() { + return new TransformTaskParams(randomAlphaOfLength(10), randomBoolean() ? null : Version.CURRENT, randomBoolean() ? null : TimeValue.timeValueMillis(randomIntBetween(1_000, 3_600_000))); } @Override - protected Reader instanceReader() { - return Transform::new; + protected Reader instanceReader() { + return TransformTaskParams::new; } public void testBackwardsSerialization() throws IOException { for (int i = 0; i < NUMBER_OF_TEST_RUNS; i++) { - Transform transformTask = createTestInstance(); + TransformTaskParams transformTask = createTestInstance(); try (BytesStreamOutput output = new BytesStreamOutput()) { output.setVersion(Version.V_7_2_0); transformTask.writeTo(output); try (StreamInput in = output.bytes().streamInput()) { in.setVersion(Version.V_7_2_0); // Since the old version does not have the version serialized, the version NOW is 7.2.0 - Transform streamedTask = new Transform(in); + TransformTaskParams streamedTask = new TransformTaskParams(in); assertThat(streamedTask.getVersion(), equalTo(Version.V_7_2_0)); assertThat(streamedTask.getId(), equalTo(transformTask.getId())); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/AuthorizationUtils.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/AuthorizationUtils.java index 308fbedb0f241..2097c5176d1fb 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/AuthorizationUtils.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/AuthorizationUtils.java @@ -19,7 +19,7 @@ import java.util.function.Predicate; import static org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskAction.TASKS_ORIGIN; -import static org.elasticsearch.xpack.core.ClientHelper.DATA_FRAME_ORIGIN; +import static org.elasticsearch.xpack.core.ClientHelper.TRANSFORM_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.DEPRECATION_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.INDEX_LIFECYCLE_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN; @@ -106,7 +106,7 @@ public static void switchUserBasedOnActionOriginAndExecute(ThreadContext threadC case WATCHER_ORIGIN: case ML_ORIGIN: case MONITORING_ORIGIN: - case DATA_FRAME_ORIGIN: + case TRANSFORM_ORIGIN: case DEPRECATION_ORIGIN: case PERSISTENT_TASK_ORIGIN: case ROLLUP_ORIGIN: diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/data_frame/transforms_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/data_frame/transforms_crud.yml index 93b69bbc3e28b..57260996bae25 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/data_frame/transforms_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/data_frame/transforms_crud.yml @@ -622,7 +622,7 @@ setup: - match: { transforms.0.state: "/started|indexing/" } - do: - catch: /Cannot delete data frame \[airline-transform-start-delete\] as the task is running/ + catch: /Cannot delete transform \[airline-transform-start-delete\] as the task is running/ data_frame.delete_data_frame_transform: transform_id: "airline-transform-start-delete" diff --git a/x-pack/plugin/transform/build.gradle b/x-pack/plugin/transform/build.gradle index 9ecd850846408..a2d61617f82d3 100644 --- a/x-pack/plugin/transform/build.gradle +++ b/x-pack/plugin/transform/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'elasticsearch.esplugin' esplugin { name 'transform' description 'A plugin to transform data' - classname 'org.elasticsearch.xpack.transform.DataFrame' + classname 'org.elasticsearch.xpack.transform.Transform' extendedPlugins = ['x-pack-core'] } diff --git a/x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTransformIT.java b/x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformIT.java similarity index 82% rename from x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTransformIT.java rename to x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformIT.java index 7cdb53515342d..d394636507cc9 100644 --- a/x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTransformIT.java +++ b/x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformIT.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.elasticsearch.Version; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; @@ -45,14 +45,14 @@ import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.oneOf; -public class DataFrameTransformIT extends DataFrameIntegTestCase { +public class TransformIT extends TransformIntegTestCase { @After public void cleanTransforms() throws IOException { cleanUp(); } - public void testDataFrameTransformCrud() throws Exception { + public void testTransformCrud() throws Exception { String indexName = "basic-crud-reviews"; createReviewsIndex(indexName, 100); @@ -65,27 +65,27 @@ public void testDataFrameTransformCrud() throws Exception { .addAggregator(AggregationBuilders.avg("review_score").field("stars")) .addAggregator(AggregationBuilders.max("timestamp").field("timestamp")); - DataFrameTransformConfig config = createTransformConfig("data-frame-transform-crud", + DataFrameTransformConfig config = createTransformConfig("transform-crud", groups, aggs, "reviews-by-user-business-day", indexName); - assertTrue(putDataFrameTransform(config, RequestOptions.DEFAULT).isAcknowledged()); - assertTrue(startDataFrameTransform(config.getId(), RequestOptions.DEFAULT).isAcknowledged()); + assertTrue(putTransform(config, RequestOptions.DEFAULT).isAcknowledged()); + assertTrue(startTransform(config.getId(), RequestOptions.DEFAULT).isAcknowledged()); waitUntilCheckpoint(config.getId(), 1L); - stopDataFrameTransform(config.getId()); + stopTransform(config.getId()); - DataFrameTransformConfig storedConfig = getDataFrameTransform(config.getId()).getTransformConfigurations().get(0); + DataFrameTransformConfig storedConfig = getTransform(config.getId()).getTransformConfigurations().get(0); assertThat(storedConfig.getVersion(), equalTo(Version.CURRENT)); Instant now = Instant.now(); assertTrue("[create_time] is not before current time", storedConfig.getCreateTime().isBefore(now)); - deleteDataFrameTransform(config.getId()); + deleteTransform(config.getId()); } - public void testContinuousDataFrameTransformCrud() throws Exception { + public void testContinuousTransformCrud() throws Exception { String indexName = "continuous-crud-reviews"; createReviewsIndex(indexName, 100); @@ -98,7 +98,7 @@ public void testContinuousDataFrameTransformCrud() throws Exception { .addAggregator(AggregationBuilders.avg("review_score").field("stars")) .addAggregator(AggregationBuilders.max("timestamp").field("timestamp")); - DataFrameTransformConfig config = createTransformConfigBuilder("data-frame-transform-crud", + DataFrameTransformConfig config = createTransformConfigBuilder("transform-crud", groups, aggs, "reviews-by-user-business-day", @@ -107,20 +107,20 @@ public void testContinuousDataFrameTransformCrud() throws Exception { .setSyncConfig(new TimeSyncConfig("timestamp", TimeValue.timeValueSeconds(1))) .build(); - assertTrue(putDataFrameTransform(config, RequestOptions.DEFAULT).isAcknowledged()); - assertTrue(startDataFrameTransform(config.getId(), RequestOptions.DEFAULT).isAcknowledged()); + assertTrue(putTransform(config, RequestOptions.DEFAULT).isAcknowledged()); + assertTrue(startTransform(config.getId(), RequestOptions.DEFAULT).isAcknowledged()); waitUntilCheckpoint(config.getId(), 1L); - assertThat(getDataFrameTransformStats(config.getId()).getTransformsStats().get(0).getState(), + assertThat(getTransformStats(config.getId()).getTransformsStats().get(0).getState(), equalTo(DataFrameTransformStats.State.STARTED)); - long docsIndexed = getDataFrameTransformStats(config.getId()) + long docsIndexed = getTransformStats(config.getId()) .getTransformsStats() .get(0) .getIndexerStats() .getNumDocuments(); - DataFrameTransformConfig storedConfig = getDataFrameTransform(config.getId()).getTransformConfigurations().get(0); + DataFrameTransformConfig storedConfig = getTransform(config.getId()).getTransformConfigurations().get(0); assertThat(storedConfig.getVersion(), equalTo(Version.CURRENT)); Instant now = Instant.now(); assertTrue("[create_time] is not before current time", storedConfig.getCreateTime().isBefore(now)); @@ -132,17 +132,17 @@ public void testContinuousDataFrameTransformCrud() throws Exception { waitUntilCheckpoint(config.getId(), 2L); // Assert that we wrote the new docs - assertThat(getDataFrameTransformStats(config.getId()) + assertThat(getTransformStats(config.getId()) .getTransformsStats() .get(0) .getIndexerStats() .getNumDocuments(), greaterThan(docsIndexed)); - stopDataFrameTransform(config.getId()); - deleteDataFrameTransform(config.getId()); + stopTransform(config.getId()); + deleteTransform(config.getId()); } - public void testContinuousDataFrameTransformUpdate() throws Exception { + public void testContinuousTransformUpdate() throws Exception { String indexName = "continuous-reviews-update"; createReviewsIndex(indexName, 10); @@ -153,7 +153,7 @@ public void testContinuousDataFrameTransformUpdate() throws Exception { .addAggregator(AggregationBuilders.avg("review_score").field("stars")) .addAggregator(AggregationBuilders.max("timestamp").field("timestamp")); - String id = "data-frame-transform-to-update"; + String id = "transform-to-update"; String dest = "reviews-by-user-business-day-to-update"; DataFrameTransformConfig config = createTransformConfigBuilder(id, groups, @@ -164,20 +164,20 @@ public void testContinuousDataFrameTransformUpdate() throws Exception { .setSyncConfig(new TimeSyncConfig("timestamp", TimeValue.timeValueSeconds(1))) .build(); - assertTrue(putDataFrameTransform(config, RequestOptions.DEFAULT).isAcknowledged()); - assertTrue(startDataFrameTransform(config.getId(), RequestOptions.DEFAULT).isAcknowledged()); + assertTrue(putTransform(config, RequestOptions.DEFAULT).isAcknowledged()); + assertTrue(startTransform(config.getId(), RequestOptions.DEFAULT).isAcknowledged()); waitUntilCheckpoint(config.getId(), 1L); - assertThat(getDataFrameTransformStats(config.getId()).getTransformsStats().get(0).getState(), + assertThat(getTransformStats(config.getId()).getTransformsStats().get(0).getState(), oneOf(DataFrameTransformStats.State.STARTED, DataFrameTransformStats.State.INDEXING)); - long docsIndexed = getDataFrameTransformStats(config.getId()) + long docsIndexed = getTransformStats(config.getId()) .getTransformsStats() .get(0) .getIndexerStats() .getNumDocuments(); - DataFrameTransformConfig storedConfig = getDataFrameTransform(config.getId()).getTransformConfigurations().get(0); + DataFrameTransformConfig storedConfig = getTransform(config.getId()).getTransformConfigurations().get(0); assertThat(storedConfig.getVersion(), equalTo(Version.CURRENT)); Instant now = Instant.now(); assertTrue("[create_time] is not before current time", storedConfig.getCreateTime().isBefore(now)); @@ -212,7 +212,7 @@ public void testContinuousDataFrameTransformUpdate() throws Exception { // Since updates are loaded on checkpoint start, we should see the updated config on this next run waitUntilCheckpoint(config.getId(), 2L); - long numDocsAfterCp2 = getDataFrameTransformStats(config.getId()) + long numDocsAfterCp2 = getTransformStats(config.getId()) .getTransformsStats() .get(0) .getIndexerStats() @@ -231,8 +231,8 @@ public void testContinuousDataFrameTransformUpdate() throws Exception { hlrc.indices().refresh(new RefreshRequest(dest), RequestOptions.DEFAULT); }, 30, TimeUnit.SECONDS); - stopDataFrameTransform(config.getId()); - deleteDataFrameTransform(config.getId()); + stopTransform(config.getId()); + deleteTransform(config.getId()); } private void indexMoreDocs(long timestamp, long userId, String index) throws Exception { diff --git a/x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameIntegTestCase.java b/x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformIntegTestCase.java similarity index 93% rename from x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameIntegTestCase.java rename to x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformIntegTestCase.java index 479926ea992bb..a53c948b69c2e 100644 --- a/x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameIntegTestCase.java +++ b/x-pack/plugin/transform/qa/multi-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformIntegTestCase.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; @@ -68,7 +68,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.core.Is.is; -abstract class DataFrameIntegTestCase extends ESRestTestCase { +abstract class TransformIntegTestCase extends ESRestTestCase { private Map transformConfigs = new HashMap<>(); @@ -79,23 +79,23 @@ protected void cleanUp() throws IOException { protected void cleanUpTransforms() throws IOException { for (DataFrameTransformConfig config : transformConfigs.values()) { - stopDataFrameTransform(config.getId()); - deleteDataFrameTransform(config.getId()); + stopTransform(config.getId()); + deleteTransform(config.getId()); } transformConfigs.clear(); } - protected StopDataFrameTransformResponse stopDataFrameTransform(String id) throws IOException { + protected StopDataFrameTransformResponse stopTransform(String id) throws IOException { RestHighLevelClient restClient = new TestRestHighLevelClient(); return restClient.dataFrame().stopDataFrameTransform(new StopDataFrameTransformRequest(id, true, null), RequestOptions.DEFAULT); } - protected StartDataFrameTransformResponse startDataFrameTransform(String id, RequestOptions options) throws IOException { + protected StartDataFrameTransformResponse startTransform(String id, RequestOptions options) throws IOException { RestHighLevelClient restClient = new TestRestHighLevelClient(); return restClient.dataFrame().startDataFrameTransform(new StartDataFrameTransformRequest(id), options); } - protected AcknowledgedResponse deleteDataFrameTransform(String id) throws IOException { + protected AcknowledgedResponse deleteTransform(String id) throws IOException { RestHighLevelClient restClient = new TestRestHighLevelClient(); AcknowledgedResponse response = restClient.dataFrame().deleteDataFrameTransform(new DeleteDataFrameTransformRequest(id), RequestOptions.DEFAULT); @@ -105,9 +105,9 @@ protected AcknowledgedResponse deleteDataFrameTransform(String id) throws IOExce return response; } - protected AcknowledgedResponse putDataFrameTransform(DataFrameTransformConfig config, RequestOptions options) throws IOException { + protected AcknowledgedResponse putTransform(DataFrameTransformConfig config, RequestOptions options) throws IOException { if (transformConfigs.keySet().contains(config.getId())) { - throw new IllegalArgumentException("data frame transform [" + config.getId() + "] is already registered"); + throw new IllegalArgumentException("transform [" + config.getId() + "] is already registered"); } RestHighLevelClient restClient = new TestRestHighLevelClient(); AcknowledgedResponse response = @@ -118,12 +118,12 @@ protected AcknowledgedResponse putDataFrameTransform(DataFrameTransformConfig co return response; } - protected GetDataFrameTransformStatsResponse getDataFrameTransformStats(String id) throws IOException { + protected GetDataFrameTransformStatsResponse getTransformStats(String id) throws IOException { RestHighLevelClient restClient = new TestRestHighLevelClient(); return restClient.dataFrame().getDataFrameTransformStats(new GetDataFrameTransformStatsRequest(id), RequestOptions.DEFAULT); } - protected GetDataFrameTransformResponse getDataFrameTransform(String id) throws IOException { + protected GetDataFrameTransformResponse getTransform(String id) throws IOException { RestHighLevelClient restClient = new TestRestHighLevelClient(); return restClient.dataFrame().getDataFrameTransform(new GetDataFrameTransformRequest(id), RequestOptions.DEFAULT); } @@ -134,7 +134,7 @@ protected void waitUntilCheckpoint(String id, long checkpoint) throws Exception protected void waitUntilCheckpoint(String id, long checkpoint, TimeValue waitTime) throws Exception { assertBusy(() -> - assertEquals(checkpoint, getDataFrameTransformStats(id) + assertEquals(checkpoint, getTransformStats(id) .getTransformsStats() .get(0) .getCheckpointingInfo() @@ -215,7 +215,7 @@ protected DataFrameTransformConfig.Builder createTransformConfigBuilder(String i .setDest(DestConfig.builder().setIndex(destinationIndex).build()) .setFrequency(TimeValue.timeValueSeconds(10)) .setPivotConfig(createPivotConfig(groups, aggregations)) - .setDescription("Test data frame transform config id: " + id); + .setDescription("Test transform config id: " + id); } protected DataFrameTransformConfig createTransformConfig(String id, diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameAuditorIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformAuditorIT.java similarity index 78% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameAuditorIT.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformAuditorIT.java index 8efad4f1fb2aa..3c433c48bdd57 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameAuditorIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformAuditorIT.java @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.elasticsearch.client.Request; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; import org.junit.Before; import java.io.IOException; @@ -22,11 +22,11 @@ import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.is; -public class DataFrameAuditorIT extends DataFrameRestTestCase { +public class TransformAuditorIT extends TransformRestTestCase { - private static final String TEST_USER_NAME = "df_admin_plus_data"; + private static final String TEST_USER_NAME = "transform_admin_plus_data"; private static final String DATA_ACCESS_ROLE = "test_data_access"; - private static final String BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS = + private static final String BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS = basicAuthHeaderValue(TEST_USER_NAME, TEST_PASSWORD_SECURE_STRING); private static boolean indicesCreated = false; @@ -54,24 +54,24 @@ public void createIndexes() throws IOException { @SuppressWarnings("unchecked") public void testAuditorWritesAudits() throws Exception { String transformId = "simple_pivot_for_audit"; - String dataFrameIndex = "pivot_reviews_user_id_above_20"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "pivot_reviews_user_id_above_20"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); String query = "\"match\": {\"user_id\": \"user_26\"}"; - createPivotReviewsTransform(transformId, dataFrameIndex, query, null, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + createPivotReviewsTransform(transformId, transformIndex, query, null, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); // Make sure we wrote to the audit - final Request request = new Request("GET", DataFrameInternalIndex.AUDIT_INDEX + "/_search"); + final Request request = new Request("GET", TransformInternalIndex.AUDIT_INDEX + "/_search"); request.setJsonEntity("{\"query\":{\"term\":{\"transform_id\":\"simple_pivot_for_audit\"}}}"); assertBusy(() -> { - assertTrue(indexExists(DataFrameInternalIndex.AUDIT_INDEX)); + assertTrue(indexExists(TransformInternalIndex.AUDIT_INDEX)); }); // Since calls to write the AbstractAuditor are sent and forgot (async) we could have returned from the start, // finished the job (as this is a very short DF job), all without the audit being fully written. assertBusy(() -> { - refreshIndex(DataFrameInternalIndex.AUDIT_INDEX); + refreshIndex(TransformInternalIndex.AUDIT_INDEX); Map response = entityAsMap(client().performRequest(request)); List hitList = ((List) ((Map)response.get("hits")).get("hits")); assertThat(hitList, is(not(empty()))); diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameConfigurationIndexIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformConfigurationIndexIT.java similarity index 82% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameConfigurationIndexIT.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformConfigurationIndexIT.java index 5487860fdb063..ad360c658164e 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameConfigurationIndexIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformConfigurationIndexIT.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -16,19 +16,19 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; import java.io.IOException; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -public class DataFrameConfigurationIndexIT extends DataFrameRestTestCase { +public class TransformConfigurationIndexIT extends TransformRestTestCase { /** * Tests the corner case that for some reason a transform configuration still exists in the index but * the persistent task disappeared * - * test note: {@link DataFrameRestTestCase} checks for an empty index as part of the test case cleanup, + * test note: {@link TransformRestTestCase} checks for an empty index as part of the test case cleanup, * so we do not need to check that the document has been deleted in this place */ public void testDeleteConfigurationLeftOver() throws IOException { @@ -42,15 +42,15 @@ public void testDeleteConfigurationLeftOver() throws IOException { builder.endObject(); final StringEntity entity = new StringEntity(Strings.toString(builder), ContentType.APPLICATION_JSON); Request req = new Request("PUT", - DataFrameInternalIndex.LATEST_INDEX_NAME + "/_doc/" + TransformConfig.documentId(fakeTransformName)); + TransformInternalIndex.LATEST_INDEX_NAME + "/_doc/" + TransformConfig.documentId(fakeTransformName)); req.setEntity(entity); client().performRequest(req); } // refresh the index - assertOK(client().performRequest(new Request("POST", DataFrameInternalIndex.LATEST_INDEX_NAME + "/_refresh"))); + assertOK(client().performRequest(new Request("POST", TransformInternalIndex.LATEST_INDEX_NAME + "/_refresh"))); - Request deleteRequest = new Request("DELETE", DATAFRAME_ENDPOINT + fakeTransformName); + Request deleteRequest = new Request("DELETE", TRANSFORM_ENDPOINT + fakeTransformName); Response deleteResponse = client().performRequest(deleteRequest); assertOK(deleteResponse); assertTrue((boolean)XContentMapValues.extractValue("acknowledged", entityAsMap(deleteResponse))); diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameGetAndGetStatsIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformGetAndGetStatsIT.java similarity index 85% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameGetAndGetStatsIT.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformGetAndGetStatsIT.java index 2be7ec693ccfd..7715086346b95 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameGetAndGetStatsIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformGetAndGetStatsIT.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.elasticsearch.client.Request; import org.elasticsearch.common.xcontent.support.XContentMapValues; @@ -26,13 +26,13 @@ import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.oneOf; -public class DataFrameGetAndGetStatsIT extends DataFrameRestTestCase { +public class TransformGetAndGetStatsIT extends TransformRestTestCase { - private static final String TEST_USER_NAME = "df_user"; - private static final String BASIC_AUTH_VALUE_DATA_FRAME_USER = + private static final String TEST_USER_NAME = "transform_user"; + private static final String BASIC_AUTH_VALUE_TRANSFORM_USER = basicAuthHeaderValue(TEST_USER_NAME, TEST_PASSWORD_SECURE_STRING); - private static final String TEST_ADMIN_USER_NAME = "df_admin"; - private static final String BASIC_AUTH_VALUE_DATA_FRAME_ADMIN = + private static final String TEST_ADMIN_USER_NAME = "transform_admin"; + private static final String BASIC_AUTH_VALUE_TRANSFORM_ADMIN = basicAuthHeaderValue(TEST_ADMIN_USER_NAME, TEST_PASSWORD_SECURE_STRING); private static boolean indicesCreated = false; @@ -59,7 +59,7 @@ public void createIndexes() throws IOException { @After public void clearOutTransforms() throws Exception { - wipeDataFrameTransforms(); + wipeTransforms(); } @SuppressWarnings("unchecked") @@ -71,26 +71,26 @@ public void testGetAndGetStats() throws Exception { startAndWaitForTransform("pivot_1", "pivot_reviews_1"); startAndWaitForTransform("pivot_2", "pivot_reviews_2"); startAndWaitForContinuousTransform("pivot_continuous", "pivot_reviews_continuous", null); - stopDataFrameTransform("pivot_1", false); - stopDataFrameTransform("pivot_2", false); + stopTransform("pivot_1", false); + stopTransform("pivot_2", false); // Alternate testing between admin and lowly user, as both should be able to get the configs and stats - String authHeader = randomFrom(BASIC_AUTH_VALUE_DATA_FRAME_USER, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN); + String authHeader = randomFrom(BASIC_AUTH_VALUE_TRANSFORM_USER, BASIC_AUTH_VALUE_TRANSFORM_ADMIN); // check all the different ways to retrieve all stats - Request getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "_stats", authHeader); + Request getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "_stats", authHeader); Map stats = entityAsMap(client().performRequest(getRequest)); assertEquals(3, XContentMapValues.extractValue("count", stats)); - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "_all/_stats", authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "_all/_stats", authHeader); stats = entityAsMap(client().performRequest(getRequest)); assertEquals(3, XContentMapValues.extractValue("count", stats)); - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "*/_stats", authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "*/_stats", authHeader); stats = entityAsMap(client().performRequest(getRequest)); assertEquals(3, XContentMapValues.extractValue("count", stats)); - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "pivot_1,pivot_2/_stats", authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "pivot_1,pivot_2/_stats", authHeader); stats = entityAsMap(client().performRequest(getRequest)); assertEquals(2, XContentMapValues.extractValue("count", stats)); - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "pivot_*/_stats", authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "pivot_*/_stats", authHeader); stats = entityAsMap(client().performRequest(getRequest)); assertEquals(3, XContentMapValues.extractValue("count", stats)); @@ -111,7 +111,7 @@ public void testGetAndGetStats() throws Exception { } // only pivot_1 - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "pivot_1/_stats", authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "pivot_1/_stats", authHeader); stats = entityAsMap(client().performRequest(getRequest)); assertEquals(1, XContentMapValues.extractValue("count", stats)); @@ -122,7 +122,7 @@ public void testGetAndGetStats() throws Exception { assertEquals(1, XContentMapValues.extractValue("checkpointing.last.checkpoint", transformsStats.get(0))); // only continuous - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "pivot_continuous/_stats", authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "pivot_continuous/_stats", authHeader); stats = entityAsMap(client().performRequest(getRequest)); assertEquals(1, XContentMapValues.extractValue("count", stats)); @@ -133,29 +133,29 @@ public void testGetAndGetStats() throws Exception { // check all the different ways to retrieve all transforms - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT, authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT, authHeader); Map transforms = entityAsMap(client().performRequest(getRequest)); assertEquals(3, XContentMapValues.extractValue("count", transforms)); - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "_all", authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "_all", authHeader); transforms = entityAsMap(client().performRequest(getRequest)); assertEquals(3, XContentMapValues.extractValue("count", transforms)); - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "*", authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "*", authHeader); transforms = entityAsMap(client().performRequest(getRequest)); assertEquals(3, XContentMapValues.extractValue("count", transforms)); // only pivot_1 - getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "pivot_1", authHeader); + getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "pivot_1", authHeader); transforms = entityAsMap(client().performRequest(getRequest)); assertEquals(1, XContentMapValues.extractValue("count", transforms)); - stopDataFrameTransform("pivot_continuous", false); + stopTransform("pivot_continuous", false); } @SuppressWarnings("unchecked") public void testGetPersistedStatsWithoutTask() throws Exception { createPivotReviewsTransform("pivot_stats_1", "pivot_reviews_stats_1", null); startAndWaitForTransform("pivot_stats_1", "pivot_reviews_stats_1"); - stopDataFrameTransform("pivot_stats_1", false); + stopTransform("pivot_stats_1", false); // Get rid of the first transform task, but keep the configuration client().performRequest(new Request("POST", "_tasks/_cancel?actions="+TransformField.TASK_NAME+"*")); @@ -168,7 +168,7 @@ public void testGetPersistedStatsWithoutTask() throws Exception { createPivotReviewsTransform("pivot_stats_2", "pivot_reviews_stats_2", null); startAndWaitForTransform("pivot_stats_2", "pivot_reviews_stats_2"); - Request getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + "_stats", BASIC_AUTH_VALUE_DATA_FRAME_ADMIN); + Request getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + "_stats", BASIC_AUTH_VALUE_TRANSFORM_ADMIN); Map stats = entityAsMap(client().performRequest(getRequest)); assertEquals(2, XContentMapValues.extractValue("count", stats)); List> transformsStats = (List>)XContentMapValues.extractValue("transforms", stats); @@ -184,15 +184,15 @@ public void testGetPersistedStatsWithoutTask() throws Exception { @SuppressWarnings("unchecked") public void testGetProgressStatsWithPivotQuery() throws Exception { String transformId = "simple_stats_pivot_with_query"; - String dataFrameIndex = "pivot_stats_reviews_user_id_above_20"; + String transformIndex = "pivot_stats_reviews_user_id_above_20"; String query = "\"match\": {\"user_id\": \"user_26\"}"; - createPivotReviewsTransform(transformId, dataFrameIndex, query); - startAndWaitForTransform(transformId, dataFrameIndex); + createPivotReviewsTransform(transformId, transformIndex, query); + startAndWaitForTransform(transformId, transformIndex); // Alternate testing between admin and lowly user, as both should be able to get the configs and stats - String authHeader = randomFrom(BASIC_AUTH_VALUE_DATA_FRAME_USER, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN); + String authHeader = randomFrom(BASIC_AUTH_VALUE_TRANSFORM_USER, BASIC_AUTH_VALUE_TRANSFORM_ADMIN); - Request getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + transformId + "/_stats", authHeader); + Request getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + transformId + "/_stats", authHeader); Map stats = entityAsMap(client().performRequest(getRequest)); assertEquals(1, XContentMapValues.extractValue("count", stats)); List> transformsStats = (List>)XContentMapValues.extractValue("transforms", stats); @@ -218,7 +218,7 @@ public void testGetStatsWithContinuous() throws Exception { String transformDest = transformId + "_idx"; String transformSrc = "reviews_cont_pivot_test"; createReviewsIndex(transformSrc); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, null); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, null); String config = "{ \"dest\": {\"index\":\"" + transformDest + "\"}," + " \"source\": {\"index\":\"" + transformSrc + "\"}," + " \"frequency\": \"1s\"," @@ -236,13 +236,13 @@ public void testGetStatsWithContinuous() throws Exception { + " } } } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); + createTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); startAndWaitForContinuousTransform(transformId, transformDest, null); - Request getRequest = createRequestWithAuth("GET", DATAFRAME_ENDPOINT + transformId + "/_stats", null); + Request getRequest = createRequestWithAuth("GET", TRANSFORM_ENDPOINT + transformId + "/_stats", null); Map stats = entityAsMap(client().performRequest(getRequest)); List> transformsStats = (List>)XContentMapValues.extractValue("transforms", stats); assertEquals(1, transformsStats.size()); @@ -284,7 +284,7 @@ public void testGetStatsWithContinuous() throws Exception { bulkRequest.setJsonEntity(bulk.toString()); client().performRequest(bulkRequest); - waitForDataFrameCheckpoint(transformId, 2L); + waitForTransformCheckpoint(transformId, 2L); // We should now have exp avgs since we have processed a continuous checkpoint assertBusy(() -> { diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTransformInternalIndexIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformInternalIndexIT.java similarity index 92% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTransformInternalIndexIT.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformInternalIndexIT.java index 6f304c1a531df..3d78c3e543aaf 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTransformInternalIndexIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformInternalIndexIT.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.GetResponse; @@ -17,7 +17,7 @@ import org.elasticsearch.search.SearchModule; import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; import org.elasticsearch.client.indices.CreateIndexRequest; import org.elasticsearch.client.transform.GetDataFrameTransformRequest; import org.elasticsearch.client.transform.GetDataFrameTransformResponse; @@ -35,15 +35,15 @@ import java.util.Collections; import static org.hamcrest.Matchers.is; -import static org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex.addDataFrameTransformsConfigMappings; +import static org.elasticsearch.xpack.transform.persistence.TransformInternalIndex.addTransformsConfigMappings; import static org.hamcrest.Matchers.equalTo; -public class DataFrameTransformInternalIndexIT extends ESRestTestCase { +public class TransformInternalIndexIT extends ESRestTestCase { - private static final String CURRENT_INDEX = DataFrameInternalIndex.LATEST_INDEX_NAME; - private static final String OLD_INDEX = DataFrameInternalIndex.INDEX_PATTERN + "1"; + private static final String CURRENT_INDEX = TransformInternalIndex.LATEST_INDEX_NAME; + private static final String OLD_INDEX = TransformInternalIndex.INDEX_PATTERN + "1"; public void testUpdateDeletesOldTransformConfig() throws Exception { @@ -54,7 +54,7 @@ public void testUpdateDeletesOldTransformConfig() throws Exception { builder.startObject(); builder.startObject("properties"); builder.startObject(TransformField.INDEX_DOC_TYPE.getPreferredName()).field("type", "keyword").endObject(); - addDataFrameTransformsConfigMappings(builder); + addTransformsConfigMappings(builder); builder.endObject(); builder.endObject(); client.indices().create(new CreateIndexRequest(OLD_INDEX).mapping(builder), RequestOptions.DEFAULT); diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameMetaDataIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformMetaDataIT.java similarity index 83% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameMetaDataIT.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformMetaDataIT.java index 26a957ea055c2..c3a38da474cc6 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameMetaDataIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformMetaDataIT.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.elasticsearch.Version; import org.elasticsearch.client.Request; @@ -15,7 +15,7 @@ import java.io.IOException; import java.util.Map; -public class DataFrameMetaDataIT extends DataFrameRestTestCase { +public class TransformMetaDataIT extends TransformRestTestCase { private boolean indicesCreated = false; @@ -46,14 +46,14 @@ public void testMetaData() throws Exception { Map mappingAsMap = entityAsMap(mappingResponse); assertEquals(Version.CURRENT.toString(), - XContentMapValues.extractValue("pivot_reviews.mappings._meta._data_frame.version.created", mappingAsMap)); - assertTrue((Long) XContentMapValues.extractValue("pivot_reviews.mappings._meta._data_frame.creation_date_in_millis", + XContentMapValues.extractValue("pivot_reviews.mappings._meta._transform.version.created", mappingAsMap)); + assertTrue((Long) XContentMapValues.extractValue("pivot_reviews.mappings._meta._transform.creation_date_in_millis", mappingAsMap) < System.currentTimeMillis()); - assertTrue((Long) XContentMapValues.extractValue("pivot_reviews.mappings._meta._data_frame.creation_date_in_millis", + assertTrue((Long) XContentMapValues.extractValue("pivot_reviews.mappings._meta._transform.creation_date_in_millis", mappingAsMap) > testStarted); assertEquals("test_meta", - XContentMapValues.extractValue("pivot_reviews.mappings._meta._data_frame.transform", mappingAsMap)); - assertEquals("data-frame-transform", + XContentMapValues.extractValue("pivot_reviews.mappings._meta._transform.transform", mappingAsMap)); + assertEquals("transform", XContentMapValues.extractValue("pivot_reviews.mappings._meta.created_by", mappingAsMap)); } diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFramePivotRestIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java similarity index 67% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFramePivotRestIT.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java index aca70d146fa3b..f590aba2c50af 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFramePivotRestIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformPivotRestIT.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.elasticsearch.client.Request; import org.elasticsearch.common.xcontent.support.XContentMapValues; @@ -24,11 +24,11 @@ import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.lessThan; -public class DataFramePivotRestIT extends DataFrameRestTestCase { +public class TransformPivotRestIT extends TransformRestTestCase { - private static final String TEST_USER_NAME = "df_admin_plus_data"; + private static final String TEST_USER_NAME = "transform_admin_plus_data"; private static final String DATA_ACCESS_ROLE = "test_data_access"; - private static final String BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS = + private static final String BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS = basicAuthHeaderValue(TEST_USER_NAME, TEST_PASSWORD_SECURE_STRING); private static boolean indicesCreated = false; @@ -55,44 +55,44 @@ public void createIndexes() throws IOException { public void testSimplePivot() throws Exception { String transformId = "simple-pivot"; - String dataFrameIndex = "pivot_reviews"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "pivot_reviews"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - createPivotReviewsTransform(transformId, dataFrameIndex, null, null, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + createPivotReviewsTransform(transformId, transformIndex, null, null, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); // we expect 27 documents as there shall be 27 user_id's - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(27, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); // get and check some users - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_0", 3.776978417); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_5", 3.72); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_11", 3.846153846); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_20", 3.769230769); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_26", 3.918918918); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_0", 3.776978417); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_5", 3.72); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_11", 3.846153846); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_20", 3.769230769); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_26", 3.918918918); } public void testSimplePivotWithQuery() throws Exception { String transformId = "simple_pivot_with_query"; - String dataFrameIndex = "pivot_reviews_user_id_above_20"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "pivot_reviews_user_id_above_20"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); String query = "\"match\": {\"user_id\": \"user_26\"}"; - createPivotReviewsTransform(transformId, dataFrameIndex, query, null, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + createPivotReviewsTransform(transformId, transformIndex, query, null, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); // we expect only 1 document due to the query - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(1, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_26", 3.918918918); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_26", 3.918918918); } public void testPivotWithPipeline() throws Exception { String transformId = "simple_pivot_with_pipeline"; - String dataFrameIndex = "pivot_with_pipeline"; + String transformIndex = "pivot_with_pipeline"; String pipelineId = "my-pivot-pipeline"; int pipelineValue = 42; Request pipelineRequest = new Request("PUT", "/_ingest/pipeline/" + pipelineId); @@ -109,36 +109,36 @@ public void testPivotWithPipeline() throws Exception { "}"); client().performRequest(pipelineRequest); - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); - createPivotReviewsTransform(transformId, dataFrameIndex, null, pipelineId, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); + createPivotReviewsTransform(transformId, transformIndex, null, pipelineId, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); // we expect 27 documents as there shall be 27 user_id's - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(27, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); // get and check some users - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_0", 3.776978417); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_5", 3.72); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_11", 3.846153846); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_20", 3.769230769); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_26", 3.918918918); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_0", 3.776978417); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_5", 3.72); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_11", 3.846153846); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_20", 3.769230769); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_26", 3.918918918); - Map searchResult = getAsMap(dataFrameIndex + "/_search?q=reviewer:user_0"); + Map searchResult = getAsMap(transformIndex + "/_search?q=reviewer:user_0"); Integer actual = (Integer) ((List) XContentMapValues.extractValue("hits.hits._source.pipeline_field", searchResult)).get(0); assertThat(actual, equalTo(pipelineValue)); } public void testBucketSelectorPivot() throws Exception { String transformId = "simple_bucket_selector_pivot"; - String dataFrameIndex = "bucket_selector_idx"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + String transformIndex = "bucket_selector_idx"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"}," + + " \"dest\": {\"index\":\"" + transformIndex + "\"}," + " \"frequency\": \"1s\"," + " \"pivot\": {" + " \"group_by\": {" @@ -158,17 +158,17 @@ public void testBucketSelectorPivot() throws Exception { + " }" + " } } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex); + assertTrue(indexExists(transformIndex)); // get and check some users - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_11", 3.846153846); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_26", 3.918918918); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_11", 3.846153846); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_26", 3.918918918); - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); // Should be less than the total number of users since we filtered every user who had an average review less than or equal to 3.8 assertEquals(21, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); } @@ -177,13 +177,13 @@ public void testContinuousPivot() throws Exception { String indexName = "continuous_reviews"; createReviewsIndex(indexName); String transformId = "simple_continuous_pivot"; - String dataFrameIndex = "pivot_reviews_continuous"; - setupDataAccessRole(DATA_ACCESS_ROLE, indexName, dataFrameIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + String transformIndex = "pivot_reviews_continuous"; + setupDataAccessRole(DATA_ACCESS_ROLE, indexName, transformIndex); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + indexName + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"}," + + " \"dest\": {\"index\":\"" + transformIndex + "\"}," + " \"frequency\": \"1s\"," + " \"sync\": {\"time\": {\"field\": \"timestamp\", \"delay\": \"1s\"}}," + " \"pivot\": {" @@ -198,20 +198,20 @@ public void testContinuousPivot() throws Exception { + " \"field\": \"stars\"" + " } } } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForContinuousTransform(transformId, dataFrameIndex, null); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForContinuousTransform(transformId, transformIndex, null); + assertTrue(indexExists(transformIndex)); // get and check some users - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_0", 3.776978417); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_5", 3.72); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_11", 3.846153846); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_20", 3.769230769); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_26", 3.918918918); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_0", 3.776978417); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_5", 3.72); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_11", 3.846153846); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_20", 3.769230769); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_26", 3.918918918); - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(27, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); final StringBuilder bulk = new StringBuilder(); long user = 42; @@ -262,25 +262,25 @@ public void testContinuousPivot() throws Exception { bulkRequest.setJsonEntity(bulk.toString()); client().performRequest(bulkRequest); - waitForDataFrameCheckpoint(transformId, 2); + waitForTransformCheckpoint(transformId, 2); - stopDataFrameTransform(transformId, false); - refreshIndex(dataFrameIndex); + stopTransform(transformId, false); + refreshIndex(transformIndex); // assert that other users are unchanged - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_0", 3.776978417); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_5", 3.72); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_11", 3.846153846); - assertOnePivotValue(dataFrameIndex + "/_search?q=reviewer:user_20", 3.769230769); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_0", 3.776978417); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_5", 3.72); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_11", 3.846153846); + assertOnePivotValue(transformIndex + "/_search?q=reviewer:user_20", 3.769230769); - Map user26searchResult = getAsMap(dataFrameIndex + "/_search?q=reviewer:user_26"); + Map user26searchResult = getAsMap(transformIndex + "/_search?q=reviewer:user_26"); assertEquals(1, XContentMapValues.extractValue("hits.total.value", user26searchResult)); double actual = (Double) ((List) XContentMapValues.extractValue("hits.hits._source.avg_rating", user26searchResult)) .get(0); assertThat(actual, greaterThan(3.92)); - Map user42searchResult = getAsMap(dataFrameIndex + "/_search?q=reviewer:user_42"); + Map user42searchResult = getAsMap(transformIndex + "/_search?q=reviewer:user_42"); assertEquals(1, XContentMapValues.extractValue("hits.total.value", user42searchResult)); actual = (Double) ((List) XContentMapValues.extractValue("hits.hits._source.avg_rating", user42searchResult)) .get(0); @@ -290,15 +290,15 @@ public void testContinuousPivot() throws Exception { public void testHistogramPivot() throws Exception { String transformId = "simple_histogram_pivot"; - String dataFrameIndex = "pivot_reviews_via_histogram"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "pivot_reviews_via_histogram"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"},"; + + " \"dest\": {\"index\":\"" + transformIndex + "\"},"; config += " \"pivot\": {" + " \"group_by\": {" @@ -313,30 +313,30 @@ public void testHistogramPivot() throws Exception { + " } } } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex); + assertTrue(indexExists(transformIndex)); // we expect 3 documents as there shall be 5 unique star values and we are bucketing every 2 starting at 0 - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(3, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); - assertOnePivotValue(dataFrameIndex + "/_search?q=every_2:0.0", 1.0); + assertOnePivotValue(transformIndex + "/_search?q=every_2:0.0", 1.0); } public void testBiggerPivot() throws Exception { String transformId = "bigger_pivot"; - String dataFrameIndex = "bigger_pivot_reviews"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "bigger_pivot_reviews"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"},"; + + " \"dest\": {\"index\":\"" + transformIndex + "\"},"; config += " \"pivot\": {" + " \"group_by\": {" @@ -372,19 +372,19 @@ public void testBiggerPivot() throws Exception { + " } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); + assertTrue(indexExists(transformIndex)); // we expect 27 documents as there shall be 27 user_id's - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(27, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); // get and check some users - Map searchResult = getAsMap(dataFrameIndex + "/_search?q=reviewer:user_4"); + Map searchResult = getAsMap(transformIndex + "/_search?q=reviewer:user_4"); assertEquals(1, XContentMapValues.extractValue("hits.total.value", searchResult)); Number actual = (Number) ((List) XContentMapValues.extractValue("hits.hits._source.avg_rating", searchResult)).get(0); @@ -403,15 +403,15 @@ public void testBiggerPivot() throws Exception { public void testDateHistogramPivot() throws Exception { String transformId = "simple_date_histogram_pivot"; - String dataFrameIndex = "pivot_reviews_via_date_histogram"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "pivot_reviews_via_date_histogram"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"},"; + + " \"dest\": {\"index\":\"" + transformIndex + "\"},"; config += " \"pivot\": {" + " \"group_by\": {" @@ -426,24 +426,24 @@ public void testDateHistogramPivot() throws Exception { + " } } } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); + createTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); + assertTrue(indexExists(transformIndex)); - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(104, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); - assertOnePivotValue(dataFrameIndex + "/_search?q=by_hr:1484499600000", 4.0833333333); + assertOnePivotValue(transformIndex + "/_search?q=by_hr:1484499600000", 4.0833333333); } @SuppressWarnings("unchecked") public void testPreviewTransform() throws Exception { setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME); - final Request createPreviewRequest = createRequestWithAuth("POST", DATAFRAME_ENDPOINT + "_preview", - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createPreviewRequest = createRequestWithAuth("POST", TRANSFORM_ENDPOINT + "_preview", + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"} ,"; @@ -460,8 +460,8 @@ public void testPreviewTransform() throws Exception { + "}"; createPreviewRequest.setJsonEntity(config); - Map previewDataframeResponse = entityAsMap(client().performRequest(createPreviewRequest)); - List> preview = (List>) previewDataframeResponse.get("preview"); + Map previewTransformResponse = entityAsMap(client().performRequest(createPreviewRequest)); + List> preview = (List>) previewTransformResponse.get("preview"); // preview is limited to 100 assertThat(preview.size(), equalTo(100)); Set expectedTopLevelFields = new HashSet<>(Arrays.asList("user", "by_day")); @@ -494,7 +494,7 @@ public void testPreviewTransformWithPipeline() throws Exception { client().performRequest(pipelineRequest); setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME); - final Request createPreviewRequest = createRequestWithAuth("POST", DATAFRAME_ENDPOINT + "_preview", null); + final Request createPreviewRequest = createRequestWithAuth("POST", TRANSFORM_ENDPOINT + "_preview", null); String config = "{ \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"} ," + "\"dest\": {\"pipeline\": \"" + pipelineId + "\"}," @@ -510,8 +510,8 @@ public void testPreviewTransformWithPipeline() throws Exception { + "}"; createPreviewRequest.setJsonEntity(config); - Map previewDataframeResponse = entityAsMap(client().performRequest(createPreviewRequest)); - List> preview = (List>)previewDataframeResponse.get("preview"); + Map previewTransformResponse = entityAsMap(client().performRequest(createPreviewRequest)); + List> preview = (List>)previewTransformResponse.get("preview"); // preview is limited to 100 assertThat(preview.size(), equalTo(100)); Set expectedTopLevelFields = new HashSet<>(Arrays.asList("user", "by_day", "pipeline_field")); @@ -528,15 +528,15 @@ public void testPreviewTransformWithPipeline() throws Exception { public void testPivotWithMaxOnDateField() throws Exception { String transformId = "simple_date_histogram_pivot_with_max_time"; - String dataFrameIndex = "pivot_reviews_via_date_histogram_with_max_time"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "pivot_reviews_via_date_histogram_with_max_time"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\": \"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"},"; + + " \"dest\": {\"index\":\"" + transformIndex + "\"},"; config +=" \"pivot\": { \n" + " \"group_by\": {\n" + @@ -555,19 +555,19 @@ public void testPivotWithMaxOnDateField() throws Exception { " }}" + "}"; - createDataframeTransformRequest.setJsonEntity(config); + createTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); + assertTrue(indexExists(transformIndex)); // we expect 21 documents as there shall be 21 days worth of docs - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(21, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); - assertOnePivotValue(dataFrameIndex + "/_search?q=by_day:2017-01-15", 3.82); - Map searchResult = getAsMap(dataFrameIndex + "/_search?q=by_day:2017-01-15"); + assertOnePivotValue(transformIndex + "/_search?q=by_day:2017-01-15", 3.82); + Map searchResult = getAsMap(transformIndex + "/_search?q=by_day:2017-01-15"); String actual = (String) ((List) XContentMapValues.extractValue("hits.hits._source.timestamp", searchResult)).get(0); // Do `containsString` as actual ending timestamp is indeterminate due to how data is generated assertThat(actual, containsString("2017-01-15T")); @@ -575,15 +575,15 @@ public void testPivotWithMaxOnDateField() throws Exception { public void testPivotWithScriptedMetricAgg() throws Exception { String transformId = "scripted_metric_pivot"; - String dataFrameIndex = "scripted_metric_pivot_reviews"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "scripted_metric_pivot_reviews"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"},"; + + " \"dest\": {\"index\":\"" + transformIndex + "\"},"; config += " \"pivot\": {" + " \"group_by\": {" @@ -606,19 +606,19 @@ public void testPivotWithScriptedMetricAgg() throws Exception { + " } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); + assertTrue(indexExists(transformIndex)); // we expect 27 documents as there shall be 27 user_id's - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(27, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); // get and check some users - Map searchResult = getAsMap(dataFrameIndex + "/_search?q=reviewer:user_4"); + Map searchResult = getAsMap(transformIndex + "/_search?q=reviewer:user_4"); assertEquals(1, XContentMapValues.extractValue("hits.total.value", searchResult)); Number actual = (Number) ((List) XContentMapValues.extractValue("hits.hits._source.avg_rating", searchResult)).get(0); assertEquals(3.878048780, actual.doubleValue(), 0.000001); @@ -628,15 +628,15 @@ public void testPivotWithScriptedMetricAgg() throws Exception { public void testPivotWithBucketScriptAgg() throws Exception { String transformId = "bucket_script_pivot"; - String dataFrameIndex = "bucket_script_pivot_reviews"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "bucket_script_pivot_reviews"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"},"; + + " \"dest\": {\"index\":\"" + transformIndex + "\"},"; config += " \"pivot\": {" + " \"group_by\": {" @@ -657,19 +657,19 @@ public void testPivotWithBucketScriptAgg() throws Exception { + " } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); + assertTrue(indexExists(transformIndex)); // we expect 27 documents as there shall be 27 user_id's - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(27, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); // get and check some users - Map searchResult = getAsMap(dataFrameIndex + "/_search?q=reviewer:user_4"); + Map searchResult = getAsMap(transformIndex + "/_search?q=reviewer:user_4"); assertEquals(1, XContentMapValues.extractValue("hits.total.value", searchResult)); Number actual = (Number) ((List) XContentMapValues.extractValue("hits.hits._source.avg_rating", searchResult)).get(0); assertEquals(3.878048780, actual.doubleValue(), 0.000001); @@ -680,15 +680,15 @@ public void testPivotWithBucketScriptAgg() throws Exception { @SuppressWarnings("unchecked") public void testPivotWithGeoBoundsAgg() throws Exception { String transformId = "geo_bounds_pivot"; - String dataFrameIndex = "geo_bounds_pivot_reviews"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "geo_bounds_pivot_reviews"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"},"; + + " \"dest\": {\"index\":\"" + transformIndex + "\"},"; config += " \"pivot\": {" + " \"group_by\": {" @@ -706,19 +706,19 @@ public void testPivotWithGeoBoundsAgg() throws Exception { + " } } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); + assertTrue(indexExists(transformIndex)); // we expect 27 documents as there shall be 27 user_id's - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(27, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); // get and check some users - Map searchResult = getAsMap(dataFrameIndex + "/_search?q=reviewer:user_4"); + Map searchResult = getAsMap(transformIndex + "/_search?q=reviewer:user_4"); assertEquals(1, XContentMapValues.extractValue("hits.total.value", searchResult)); Number actual = (Number) ((List) XContentMapValues.extractValue("hits.hits._source.avg_rating", searchResult)).get(0); assertEquals(3.878048780, actual.doubleValue(), 0.000001); @@ -733,15 +733,15 @@ public void testPivotWithGeoBoundsAgg() throws Exception { public void testPivotWithGeoCentroidAgg() throws Exception { String transformId = "geo_centroid_pivot"; - String dataFrameIndex = "geo_centroid_pivot_reviews"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "geo_centroid_pivot_reviews"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"},"; + + " \"dest\": {\"index\":\"" + transformIndex + "\"},"; config += " \"pivot\": {" + " \"group_by\": {" @@ -759,19 +759,19 @@ public void testPivotWithGeoCentroidAgg() throws Exception { + " } } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); + assertTrue(indexExists(transformIndex)); // we expect 27 documents as there shall be 27 user_id's - Map indexStats = getAsMap(dataFrameIndex + "/_stats"); + Map indexStats = getAsMap(transformIndex + "/_stats"); assertEquals(27, XContentMapValues.extractValue("_all.total.docs.count", indexStats)); // get and check some users - Map searchResult = getAsMap(dataFrameIndex + "/_search?q=reviewer:user_4"); + Map searchResult = getAsMap(transformIndex + "/_search?q=reviewer:user_4"); assertEquals(1, XContentMapValues.extractValue("hits.total.value", searchResult)); Number actual = (Number) ((List) XContentMapValues.extractValue("hits.hits._source.avg_rating", searchResult)).get(0); assertEquals(3.878048780, actual.doubleValue(), 0.000001); @@ -783,15 +783,15 @@ public void testPivotWithGeoCentroidAgg() throws Exception { public void testPivotWithWeightedAvgAgg() throws Exception { String transformId = "weighted_avg_agg_transform"; - String dataFrameIndex = "weighted_avg_pivot_reviews"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); + String transformIndex = "weighted_avg_pivot_reviews"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"},"; + + " \"dest\": {\"index\":\"" + transformIndex + "\"},"; config += " \"pivot\": {" + " \"group_by\": {" @@ -807,14 +807,14 @@ public void testPivotWithWeightedAvgAgg() throws Exception { + "} } } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); + assertTrue(indexExists(transformIndex)); - Map searchResult = getAsMap(dataFrameIndex + "/_search?q=reviewer:user_4"); + Map searchResult = getAsMap(transformIndex + "/_search?q=reviewer:user_4"); assertEquals(1, XContentMapValues.extractValue("hits.total.value", searchResult)); Number actual = (Number) ((List) XContentMapValues.extractValue("hits.hits._source.avg_rating", searchResult)).get(0); assertEquals(4.47169811, actual.doubleValue(), 0.000001); @@ -822,14 +822,14 @@ public void testPivotWithWeightedAvgAgg() throws Exception { public void testManyBucketsWithSmallPageSize() throws Exception { String transformId = "test_with_many_buckets"; - String dataFrameIndex = transformId + "-idx"; - setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, dataFrameIndex); - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, - BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); + String transformIndex = transformId + "-idx"; + setupDataAccessRole(DATA_ACCESS_ROLE, REVIEWS_INDEX_NAME, transformIndex); + final Request createTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, + BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); String config = "{" + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," - + " \"dest\": {\"index\":\"" + dataFrameIndex + "\"}," + + " \"dest\": {\"index\":\"" + transformIndex + "\"}," + " \"pivot\": {" + " \"max_page_search_size\": 10," + " \"group_by\": {" @@ -846,14 +846,14 @@ public void testManyBucketsWithSmallPageSize() throws Exception { + " \"field\": \"stars\"" + " } } } }" + "}"; - createDataframeTransformRequest.setJsonEntity(config); - Map createDataframeTransformResponse = entityAsMap(client().performRequest(createDataframeTransformRequest)); - assertThat(createDataframeTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); + createTransformRequest.setJsonEntity(config); + Map createTransformResponse = entityAsMap(client().performRequest(createTransformRequest)); + assertThat(createTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); - startAndWaitForTransform(transformId, dataFrameIndex, BASIC_AUTH_VALUE_DATA_FRAME_ADMIN_WITH_SOME_DATA_ACCESS); - assertTrue(indexExists(dataFrameIndex)); + startAndWaitForTransform(transformId, transformIndex, BASIC_AUTH_VALUE_TRANSFORM_ADMIN_WITH_SOME_DATA_ACCESS); + assertTrue(indexExists(transformIndex)); - Map stats = getAsMap(DATAFRAME_ENDPOINT + transformId + "/_stats"); + Map stats = getAsMap(TRANSFORM_ENDPOINT + transformId + "/_stats"); assertEquals(101, ((List)XContentMapValues.extractValue("transforms.stats.pages_processed", stats)).get(0)); } diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTransformProgressIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformProgressIT.java similarity index 94% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTransformProgressIT.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformProgressIT.java index 969bdd7209d38..16923f7772c73 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTransformProgressIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformProgressIT.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; import org.elasticsearch.action.bulk.BulkRequest; @@ -39,11 +39,11 @@ import java.util.Collections; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.dataframe.integration.DataFrameRestTestCase.REVIEWS_INDEX_NAME; +import static org.elasticsearch.xpack.transform.integration.TransformRestTestCase.REVIEWS_INDEX_NAME; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -public class DataFrameTransformProgressIT extends ESRestTestCase { +public class TransformProgressIT extends ESRestTestCase { protected void createReviewsIndex() throws Exception { final int numDocs = 1000; final RestHighLevelClient restClient = new TestRestHighLevelClient(); @@ -141,7 +141,7 @@ public void testGetProgress() throws Exception { RequestOptions.DEFAULT); TransformProgress progress = - TransformProgressGatherer.searchResponseToDataFrameTransformProgressFunction().apply(response); + TransformProgressGatherer.searchResponseToTransformProgressFunction().apply(response); assertThat(progress.getTotalDocs(), equalTo(1000L)); assertThat(progress.getDocumentsProcessed(), equalTo(0L)); @@ -162,7 +162,7 @@ public void testGetProgress() throws Exception { response = restClient.search(TransformProgressGatherer.getSearchRequest(config, config.getSource().getQueryConfig().getQuery()), RequestOptions.DEFAULT); - progress = TransformProgressGatherer.searchResponseToDataFrameTransformProgressFunction().apply(response); + progress = TransformProgressGatherer.searchResponseToTransformProgressFunction().apply(response); assertThat(progress.getTotalDocs(), equalTo(35L)); assertThat(progress.getDocumentsProcessed(), equalTo(0L)); @@ -182,7 +182,7 @@ public void testGetProgress() throws Exception { response = restClient.search(TransformProgressGatherer.getSearchRequest(config, config.getSource().getQueryConfig().getQuery()), RequestOptions.DEFAULT); - progress = TransformProgressGatherer.searchResponseToDataFrameTransformProgressFunction().apply(response); + progress = TransformProgressGatherer.searchResponseToTransformProgressFunction().apply(response); assertThat(progress.getTotalDocs(), equalTo(0L)); assertThat(progress.getDocumentsProcessed(), equalTo(0L)); diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameRestTestCase.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java similarity index 93% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameRestTestCase.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java index 091573f857d46..372efddc57ca9 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameRestTestCase.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformRestTestCase.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -20,7 +20,7 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xpack.core.transform.TransformField; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; import org.junit.After; import org.junit.AfterClass; @@ -36,7 +36,7 @@ import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue; import static org.hamcrest.Matchers.equalTo; -public abstract class DataFrameRestTestCase extends ESRestTestCase { +public abstract class TransformRestTestCase extends ESRestTestCase { protected static final String TEST_PASSWORD = "x-pack-test-password"; protected static final SecureString TEST_PASSWORD_SECURE_STRING = new SecureString(TEST_PASSWORD.toCharArray()); @@ -44,7 +44,7 @@ public abstract class DataFrameRestTestCase extends ESRestTestCase { protected static final String REVIEWS_INDEX_NAME = "reviews"; - protected static final String DATAFRAME_ENDPOINT = TransformField.REST_BASE_PATH + "transforms/"; + protected static final String TRANSFORM_ENDPOINT = TransformField.REST_BASE_PATH + "transforms/"; @Override protected Settings restClientSettings() { @@ -159,7 +159,7 @@ protected void createPivotReviewsTransform(String transformId, String dataFrameI protected void createContinuousPivotReviewsTransform(String transformId, String dataFrameIndex, String authHeader) throws IOException { - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, authHeader); + final Request createDataframeTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, authHeader); String config = "{ \"dest\": {\"index\":\"" + dataFrameIndex + "\"}," + " \"source\": {\"index\":\"" + REVIEWS_INDEX_NAME + "\"}," @@ -188,7 +188,7 @@ protected void createContinuousPivotReviewsTransform(String transformId, String protected void createPivotReviewsTransform(String transformId, String dataFrameIndex, String query, String pipeline, String authHeader) throws IOException { - final Request createDataframeTransformRequest = createRequestWithAuth("PUT", DATAFRAME_ENDPOINT + transformId, authHeader); + final Request createDataframeTransformRequest = createRequestWithAuth("PUT", TRANSFORM_ENDPOINT + transformId, authHeader); String config = "{"; @@ -230,7 +230,7 @@ protected void startDataframeTransform(String transformId) throws IOException { protected void startDataframeTransform(String transformId, String authHeader, String... warnings) throws IOException { // start the transform - final Request startTransformRequest = createRequestWithAuth("POST", DATAFRAME_ENDPOINT + transformId + "/_start", authHeader); + final Request startTransformRequest = createRequestWithAuth("POST", TRANSFORM_ENDPOINT + transformId + "/_start", authHeader); if (warnings.length > 0) { startTransformRequest.setOptions(expectWarnings(warnings)); } @@ -238,9 +238,9 @@ protected void startDataframeTransform(String transformId, String authHeader, St assertThat(startTransformResponse.get("acknowledged"), equalTo(Boolean.TRUE)); } - protected void stopDataFrameTransform(String transformId, boolean force) throws Exception { + protected void stopTransform(String transformId, boolean force) throws Exception { // start the transform - final Request stopTransformRequest = createRequestWithAuth("POST", DATAFRAME_ENDPOINT + transformId + "/_stop", null); + final Request stopTransformRequest = createRequestWithAuth("POST", TRANSFORM_ENDPOINT + transformId + "/_stop", null); stopTransformRequest.addParameter(TransformField.FORCE.getPreferredName(), Boolean.toString(force)); stopTransformRequest.addParameter(TransformField.WAIT_FOR_COMPLETION.getPreferredName(), Boolean.toString(true)); Map stopTransformResponse = entityAsMap(client().performRequest(stopTransformRequest)); @@ -281,7 +281,7 @@ protected void startAndWaitForContinuousTransform(String transformId, startDataframeTransform(transformId, authHeader, new String[0]); assertTrue(indexExists(dataFrameIndex)); // wait until the dataframe has been created and all data is available - waitForDataFrameCheckpoint(transformId, checkpoint); + waitForTransformCheckpoint(transformId, checkpoint); refreshIndex(dataFrameIndex); } @@ -304,10 +304,10 @@ void waitForDataFrameStopped(String transformId) throws Exception { } void waitForDataFrameCheckpoint(String transformId) throws Exception { - waitForDataFrameCheckpoint(transformId, 1L); + waitForTransformCheckpoint(transformId, 1L); } - void waitForDataFrameCheckpoint(String transformId, long checkpoint) throws Exception { + void waitForTransformCheckpoint(String transformId, long checkpoint) throws Exception { assertBusy(() -> assertEquals(checkpoint, getDataFrameCheckpoint(transformId)), 30, TimeUnit.SECONDS); } @@ -317,7 +317,7 @@ void refreshIndex(String index) throws IOException { @SuppressWarnings("unchecked") private static List> getDataFrameTransforms() throws IOException { - Response response = adminClient().performRequest(new Request("GET", DATAFRAME_ENDPOINT + "_all")); + Response response = adminClient().performRequest(new Request("GET", TRANSFORM_ENDPOINT + "_all")); Map transforms = entityAsMap(response); List> transformConfigs = (List>) XContentMapValues.extractValue("transforms", transforms); @@ -330,7 +330,7 @@ protected static String getDataFrameTransformState(String transformId) throws IO } protected static Map getDataFrameState(String transformId) throws IOException { - Response statsResponse = client().performRequest(new Request("GET", DATAFRAME_ENDPOINT + transformId + "/_stats")); + Response statsResponse = client().performRequest(new Request("GET", TRANSFORM_ENDPOINT + transformId + "/_stats")); List transforms = ((List) entityAsMap(statsResponse).get("transforms")); if (transforms.isEmpty()) { return null; @@ -338,15 +338,15 @@ protected static String getDataFrameTransformState(String transformId) throws IO return (Map) transforms.get(0); } - protected static void deleteDataFrameTransform(String transformId) throws IOException { - Request request = new Request("DELETE", DATAFRAME_ENDPOINT + transformId); + protected static void deleteTransform(String transformId) throws IOException { + Request request = new Request("DELETE", TRANSFORM_ENDPOINT + transformId); request.addParameter("ignore", "404"); // Ignore 404s because they imply someone was racing us to delete this adminClient().performRequest(request); } @After public void waitForDataFrame() throws Exception { - wipeDataFrameTransforms(); + wipeTransforms(); waitForPendingDataFrameTasks(); } @@ -357,11 +357,11 @@ public static void removeIndices() throws Exception { wipeAllIndices(); } - public void wipeDataFrameTransforms() throws IOException { + public void wipeTransforms() throws IOException { List> transformConfigs = getDataFrameTransforms(); for (Map transformConfig : transformConfigs) { String transformId = (String) transformConfig.get("id"); - Request request = new Request("POST", DATAFRAME_ENDPOINT + transformId + "/_stop"); + Request request = new Request("POST", TRANSFORM_ENDPOINT + transformId + "/_stop"); request.addParameter("wait_for_completion", "true"); request.addParameter("timeout", "10s"); request.addParameter("ignore", "404"); @@ -376,7 +376,7 @@ public void wipeDataFrameTransforms() throws IOException { for (Map transformConfig : transformConfigs) { String transformId = (String) transformConfig.get("id"); - deleteDataFrameTransform(transformId); + deleteTransform(transformId); } // transforms should be all gone @@ -384,7 +384,7 @@ public void wipeDataFrameTransforms() throws IOException { assertTrue(transformConfigs.isEmpty()); // the configuration index should be empty - Request request = new Request("GET", DataFrameInternalIndex.LATEST_INDEX_NAME + "/_search"); + Request request = new Request("GET", TransformInternalIndex.LATEST_INDEX_NAME + "/_search"); try { Response searchResponse = adminClient().performRequest(request); Map searchResult = entityAsMap(searchResponse); @@ -403,7 +403,7 @@ protected static void waitForPendingDataFrameTasks() throws Exception { } static int getDataFrameCheckpoint(String transformId) throws IOException { - Response statsResponse = client().performRequest(new Request("GET", DATAFRAME_ENDPOINT + transformId + "/_stats")); + Response statsResponse = client().performRequest(new Request("GET", TRANSFORM_ENDPOINT + transformId + "/_stats")); Map transformStatsAsMap = (Map) ((List) entityAsMap(statsResponse).get("transforms")).get(0); return (int) XContentMapValues.extractValue("checkpointing.last.checkpoint", transformStatsAsMap); diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTaskFailedStateIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformTaskFailedStateIT.java similarity index 84% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTaskFailedStateIT.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformTaskFailedStateIT.java index 43df1ff350898..a9f8a9bc963cc 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameTaskFailedStateIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformTaskFailedStateIT.java @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -29,7 +29,7 @@ import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.Matchers.equalTo; -public class DataFrameTaskFailedStateIT extends DataFrameRestTestCase { +public class TransformTaskFailedStateIT extends TransformRestTestCase { private final List failureTransforms = new ArrayList<>(); @Before @@ -39,10 +39,10 @@ public void setClusterSettings() throws IOException { // see: https://github.com/elastic/elasticsearch/issues/45562 Request addFailureRetrySetting = new Request("PUT", "/_cluster/settings"); addFailureRetrySetting.setJsonEntity( - "{\"transient\": {\"xpack.data_frame.num_transform_failure_retries\": \"" + 0 + "\"," + + "{\"transient\": {\"xpack.transform.num_transform_failure_retries\": \"" + 0 + "\"," + "\"logger.org.elasticsearch.action.bulk\": \"info\"," + // reduces bulk failure spam "\"logger.org.elasticsearch.xpack.core.indexing.AsyncTwoPhaseIndexer\": \"trace\"," + - "\"logger.org.elasticsearch.xpack.dataframe\": \"trace\"}}"); + "\"logger.org.elasticsearch.xpack.transform\": \"trace\"}}"); client().performRequest(addFailureRetrySetting); } @@ -51,17 +51,17 @@ public void cleanUpPotentiallyFailedTransform() throws Exception { // If the tests failed in the middle, we should force stop it. This prevents other transform tests from failing due // to this left over transform for (String transformId : failureTransforms) { - stopDataFrameTransform(transformId, true); - deleteDataFrameTransform(transformId); + stopTransform(transformId, true); + deleteTransform(transformId); } } public void testForceStopFailedTransform() throws Exception { String transformId = "test-force-stop-failed-transform"; createReviewsIndex(REVIEWS_INDEX_NAME, 10); - String dataFrameIndex = "failure_pivot_reviews"; - createDestinationIndexWithBadMapping(dataFrameIndex); - createContinuousPivotReviewsTransform(transformId, dataFrameIndex, null); + String transformIndex = "failure_pivot_reviews"; + createDestinationIndexWithBadMapping(transformIndex); + createContinuousPivotReviewsTransform(transformId, transformIndex, null); failureTransforms.add(transformId); startDataframeTransform(transformId); awaitState(transformId, TransformStats.State.FAILED); @@ -72,15 +72,15 @@ public void testForceStopFailedTransform() throws Exception { assertThat(XContentMapValues.extractValue("reason", fullState), equalTo(failureReason)); // verify that we cannot stop a failed transform - ResponseException ex = expectThrows(ResponseException.class, () -> stopDataFrameTransform(transformId, false)); + ResponseException ex = expectThrows(ResponseException.class, () -> stopTransform(transformId, false)); assertThat(ex.getResponse().getStatusLine().getStatusCode(), equalTo(RestStatus.CONFLICT.getStatus())); assertThat(XContentMapValues.extractValue("error.reason", entityAsMap(ex.getResponse())), - equalTo("Unable to stop data frame transform [test-force-stop-failed-transform] as it is in a failed state with reason [" + + equalTo("Unable to stop transform [test-force-stop-failed-transform] as it is in a failed state with reason [" + failureReason + - "]. Use force stop to stop the data frame transform.")); + "]. Use force stop to stop the transform.")); // Verify that we can force stop a failed transform - stopDataFrameTransform(transformId, true); + stopTransform(transformId, true); awaitState(transformId, TransformStats.State.STOPPED); fullState = getDataFrameState(transformId); @@ -102,9 +102,9 @@ public void testStartFailedTransform() throws Exception { // Verify we have failed for the expected reason assertThat(XContentMapValues.extractValue("reason", fullState), equalTo(failureReason)); - final String expectedFailure = "Unable to start data frame transform [test-force-start-failed-transform] " + + final String expectedFailure = "Unable to start transform [test-force-start-failed-transform] " + "as it is in a failed state with failure: [" + failureReason + - "]. Use force stop and then restart the data frame transform once error is resolved."; + "]. Use force stop and then restart the transform once error is resolved."; // Verify that we cannot start the transform when the task is in a failed state assertBusy(() -> { ResponseException ex = expectThrows(ResponseException.class, () -> startDataframeTransform(transformId)); @@ -113,7 +113,7 @@ public void testStartFailedTransform() throws Exception { equalTo(expectedFailure)); }, 60, TimeUnit.SECONDS); - stopDataFrameTransform(transformId, true); + stopTransform(transformId, true); } private void awaitState(String transformId, TransformStats.State state) throws Exception { diff --git a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameUsageIT.java b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformUsageIT.java similarity index 90% rename from x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameUsageIT.java rename to x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformUsageIT.java index 3137ef4806a4e..b3b1dd7ccaff1 100644 --- a/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/dataframe/integration/DataFrameUsageIT.java +++ b/x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/TransformUsageIT.java @@ -4,14 +4,14 @@ * you may not use this file except in compliance with the Elastic License. */ -package org.elasticsearch.xpack.dataframe.integration; +package org.elasticsearch.xpack.transform.integration; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.xpack.core.transform.transforms.TransformIndexerStats; import org.elasticsearch.xpack.core.transform.transforms.TransformStoredDoc; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; import org.junit.Before; import java.io.IOException; @@ -21,9 +21,9 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.xpack.core.transform.TransformField.INDEX_DOC_TYPE; -import static org.elasticsearch.xpack.transform.DataFrameInfoTransportAction.PROVIDED_STATS; +import static org.elasticsearch.xpack.transform.TransformInfoTransportAction.PROVIDED_STATS; -public class DataFrameUsageIT extends DataFrameRestTestCase { +public class TransformUsageIT extends TransformRestTestCase { @Before public void createIndexes() throws IOException { @@ -50,10 +50,10 @@ public void testUsage() throws Exception { assertEquals(3, XContentMapValues.extractValue("transform.transforms.stopped", usageAsMap)); startAndWaitForTransform("test_usage", "pivot_reviews"); - stopDataFrameTransform("test_usage", false); + stopTransform("test_usage", false); Request statsExistsRequest = new Request("GET", - DataFrameInternalIndex.LATEST_INDEX_NAME+"/_search?q=" + + TransformInternalIndex.LATEST_INDEX_NAME+"/_search?q=" + INDEX_DOC_TYPE.getPreferredName() + ":" + TransformStoredDoc.NAME); // Verify that we have one stat document @@ -64,7 +64,7 @@ public void testUsage() throws Exception { startAndWaitForContinuousTransform("test_usage_continuous", "pivot_reviews_continuous", null); - Request getRequest = new Request("GET", DATAFRAME_ENDPOINT + "test_usage/_stats"); + Request getRequest = new Request("GET", TRANSFORM_ENDPOINT + "test_usage/_stats"); Map stats = entityAsMap(client().performRequest(getRequest)); Map expectedStats = new HashMap<>(); for(String statName : PROVIDED_STATS) { @@ -95,11 +95,11 @@ public void testUsage() throws Exception { XContentMapValues.extractValue("transform.stats." + statName, statsMap)); } // Refresh the index so that statistics are searchable - refreshIndex(DataFrameInternalIndex.LATEST_INDEX_VERSIONED_NAME); + refreshIndex(TransformInternalIndex.LATEST_INDEX_VERSIONED_NAME); }, 60, TimeUnit.SECONDS); - stopDataFrameTransform("test_usage_continuous", false); + stopTransform("test_usage_continuous", false); usageResponse = client().performRequest(new Request("GET", "_xpack/usage")); usageAsMap = entityAsMap(usageResponse); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/DataFrame.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/Transform.java similarity index 61% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/DataFrame.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/Transform.java index e13f266a05f86..7209dc8529092 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/DataFrame.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/Transform.java @@ -53,28 +53,28 @@ import org.elasticsearch.xpack.core.transform.action.StartTransformAction; import org.elasticsearch.xpack.core.transform.action.StopTransformAction; import org.elasticsearch.xpack.core.transform.action.UpdateTransformAction; -import org.elasticsearch.xpack.transform.action.TransportDeleteDataFrameTransformAction; -import org.elasticsearch.xpack.transform.action.TransportGetDataFrameTransformsAction; -import org.elasticsearch.xpack.transform.action.TransportGetDataFrameTransformsStatsAction; -import org.elasticsearch.xpack.transform.action.TransportPreviewDataFrameTransformAction; -import org.elasticsearch.xpack.transform.action.TransportPutDataFrameTransformAction; -import org.elasticsearch.xpack.transform.action.TransportStartDataFrameTransformAction; -import org.elasticsearch.xpack.transform.action.TransportStopDataFrameTransformAction; -import org.elasticsearch.xpack.transform.action.TransportUpdateDataFrameTransformAction; -import org.elasticsearch.xpack.transform.checkpoint.DataFrameTransformsCheckpointService; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; -import org.elasticsearch.xpack.transform.rest.action.RestDeleteDataFrameTransformAction; -import org.elasticsearch.xpack.transform.rest.action.RestGetDataFrameTransformsAction; -import org.elasticsearch.xpack.transform.rest.action.RestGetDataFrameTransformsStatsAction; -import org.elasticsearch.xpack.transform.rest.action.RestPreviewDataFrameTransformAction; -import org.elasticsearch.xpack.transform.rest.action.RestPutDataFrameTransformAction; -import org.elasticsearch.xpack.transform.rest.action.RestStartDataFrameTransformAction; -import org.elasticsearch.xpack.transform.rest.action.RestStopDataFrameTransformAction; -import org.elasticsearch.xpack.transform.rest.action.RestUpdateDataFrameTransformAction; -import org.elasticsearch.xpack.transform.transforms.DataFrameTransformPersistentTasksExecutor; -import org.elasticsearch.xpack.transform.transforms.DataFrameTransformTask; +import org.elasticsearch.xpack.transform.action.TransportDeleteTransformAction; +import org.elasticsearch.xpack.transform.action.TransportGetTransformsAction; +import org.elasticsearch.xpack.transform.action.TransportGetTransformsStatsAction; +import org.elasticsearch.xpack.transform.action.TransportPreviewTransformAction; +import org.elasticsearch.xpack.transform.action.TransportPutTransformAction; +import org.elasticsearch.xpack.transform.action.TransportStartTransformAction; +import org.elasticsearch.xpack.transform.action.TransportStopTransformAction; +import org.elasticsearch.xpack.transform.action.TransportUpdateTransformAction; +import org.elasticsearch.xpack.transform.checkpoint.TransformCheckpointService; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; +import org.elasticsearch.xpack.transform.rest.action.RestDeleteTransformAction; +import org.elasticsearch.xpack.transform.rest.action.RestGetTransformAction; +import org.elasticsearch.xpack.transform.rest.action.RestGetTransformStatsAction; +import org.elasticsearch.xpack.transform.rest.action.RestPreviewTransformAction; +import org.elasticsearch.xpack.transform.rest.action.RestPutTransformAction; +import org.elasticsearch.xpack.transform.rest.action.RestStartTransformAction; +import org.elasticsearch.xpack.transform.rest.action.RestStopTransformAction; +import org.elasticsearch.xpack.transform.rest.action.RestUpdateTransformAction; +import org.elasticsearch.xpack.transform.transforms.TransformPersistentTasksExecutor; +import org.elasticsearch.xpack.transform.transforms.TransformTask; import java.io.IOException; import java.time.Clock; @@ -88,23 +88,23 @@ import static java.util.Collections.emptyList; -public class DataFrame extends Plugin implements ActionPlugin, PersistentTaskPlugin { +public class Transform extends Plugin implements ActionPlugin, PersistentTaskPlugin { - public static final String NAME = "data_frame"; - public static final String TASK_THREAD_POOL_NAME = "data_frame_indexing"; + public static final String NAME = "transform"; + public static final String TASK_THREAD_POOL_NAME = "transform_indexing"; - private static final Logger logger = LogManager.getLogger(DataFrame.class); + private static final Logger logger = LogManager.getLogger(Transform.class); private final boolean enabled; private final Settings settings; - private final SetOnce dataFrameTransformsConfigManager = new SetOnce<>(); - private final SetOnce dataFrameAuditor = new SetOnce<>(); - private final SetOnce dataFrameTransformsCheckpointService = new SetOnce<>(); + private final SetOnce transformsConfigManager = new SetOnce<>(); + private final SetOnce transformAuditor = new SetOnce<>(); + private final SetOnce transformCheckpointService = new SetOnce<>(); private final SetOnce schedulerEngine = new SetOnce<>(); - public DataFrame(Settings settings) { + public Transform(Settings settings) { this.settings = settings; - this.enabled = XPackSettings.DATA_FRAME_ENABLED.get(settings); + this.enabled = XPackSettings.TRANSFORM_ENABLED.get(settings); } protected XPackLicenseState getLicenseState() { return XPackPlugin.getSharedLicenseState(); } @@ -119,34 +119,34 @@ public List getRestHandlers(final Settings settings, final RestCont } return Arrays.asList( - new RestPutDataFrameTransformAction(restController), - new RestStartDataFrameTransformAction(restController), - new RestStopDataFrameTransformAction(restController), - new RestDeleteDataFrameTransformAction(restController), - new RestGetDataFrameTransformsAction(restController), - new RestGetDataFrameTransformsStatsAction(restController), - new RestPreviewDataFrameTransformAction(restController), - new RestUpdateDataFrameTransformAction(restController) + new RestPutTransformAction(restController), + new RestStartTransformAction(restController), + new RestStopTransformAction(restController), + new RestDeleteTransformAction(restController), + new RestGetTransformAction(restController), + new RestGetTransformStatsAction(restController), + new RestPreviewTransformAction(restController), + new RestUpdateTransformAction(restController) ); } @Override public List> getActions() { - var usageAction = new ActionHandler<>(XPackUsageFeatureAction.DATA_FRAME, DataFrameUsageTransportAction.class); - var infoAction = new ActionHandler<>(XPackInfoFeatureAction.DATA_FRAME, DataFrameInfoTransportAction.class); + var usageAction = new ActionHandler<>(XPackUsageFeatureAction.TRANSFORM, TransformUsageTransportAction.class); + var infoAction = new ActionHandler<>(XPackInfoFeatureAction.TRANSFORM, TransformInfoTransportAction.class); if (enabled == false) { return Arrays.asList(usageAction, infoAction); } return Arrays.asList( - new ActionHandler<>(PutTransformAction.INSTANCE, TransportPutDataFrameTransformAction.class), - new ActionHandler<>(StartTransformAction.INSTANCE, TransportStartDataFrameTransformAction.class), - new ActionHandler<>(StopTransformAction.INSTANCE, TransportStopDataFrameTransformAction.class), - new ActionHandler<>(DeleteTransformAction.INSTANCE, TransportDeleteDataFrameTransformAction.class), - new ActionHandler<>(GetTransformsAction.INSTANCE, TransportGetDataFrameTransformsAction.class), - new ActionHandler<>(GetTransformsStatsAction.INSTANCE, TransportGetDataFrameTransformsStatsAction.class), - new ActionHandler<>(PreviewTransformAction.INSTANCE, TransportPreviewDataFrameTransformAction.class), - new ActionHandler<>(UpdateTransformAction.INSTANCE, TransportUpdateDataFrameTransformAction.class), + new ActionHandler<>(PutTransformAction.INSTANCE, TransportPutTransformAction.class), + new ActionHandler<>(StartTransformAction.INSTANCE, TransportStartTransformAction.class), + new ActionHandler<>(StopTransformAction.INSTANCE, TransportStopTransformAction.class), + new ActionHandler<>(DeleteTransformAction.INSTANCE, TransportDeleteTransformAction.class), + new ActionHandler<>(GetTransformsAction.INSTANCE, TransportGetTransformsAction.class), + new ActionHandler<>(GetTransformsStatsAction.INSTANCE, TransportGetTransformsStatsAction.class), + new ActionHandler<>(PreviewTransformAction.INSTANCE, TransportPreviewTransformAction.class), + new ActionHandler<>(UpdateTransformAction.INSTANCE, TransportUpdateTransformAction.class), usageAction, infoAction); } @@ -170,25 +170,25 @@ public Collection createComponents(Client client, ClusterService cluster if (enabled == false) { return emptyList(); } - dataFrameAuditor.set(new DataFrameAuditor(client, clusterService.getNodeName())); - dataFrameTransformsConfigManager.set(new DataFrameTransformsConfigManager(client, xContentRegistry)); - dataFrameTransformsCheckpointService.set(new DataFrameTransformsCheckpointService(client, - dataFrameTransformsConfigManager.get(), - dataFrameAuditor.get())); + transformAuditor.set(new TransformAuditor(client, clusterService.getNodeName())); + transformsConfigManager.set(new TransformConfigManager(client, xContentRegistry)); + transformCheckpointService.set(new TransformCheckpointService(client, + transformsConfigManager.get(), + transformAuditor.get())); - return Arrays.asList(dataFrameTransformsConfigManager.get(), dataFrameAuditor.get(), dataFrameTransformsCheckpointService.get()); + return Arrays.asList(transformsConfigManager.get(), transformAuditor.get(), transformCheckpointService.get()); } @Override public UnaryOperator> getIndexTemplateMetaDataUpgrader() { return templates -> { try { - templates.put(DataFrameInternalIndex.LATEST_INDEX_VERSIONED_NAME, DataFrameInternalIndex.getIndexTemplateMetaData()); + templates.put(TransformInternalIndex.LATEST_INDEX_VERSIONED_NAME, TransformInternalIndex.getIndexTemplateMetaData()); } catch (IOException e) { logger.error("Error creating data frame index template", e); } try { - templates.put(DataFrameInternalIndex.AUDIT_INDEX, DataFrameInternalIndex.getAuditIndexTemplateMetaData()); + templates.put(TransformInternalIndex.AUDIT_INDEX, TransformInternalIndex.getAuditIndexTemplateMetaData()); } catch (IOException e) { logger.warn("Error creating data frame audit index", e); } @@ -206,17 +206,17 @@ public List> getPersistentTasksExecutor(ClusterServic schedulerEngine.set(new SchedulerEngine(settings, Clock.systemUTC())); // the transforms config manager should have been created - assert dataFrameTransformsConfigManager.get() != null; + assert transformsConfigManager.get() != null; // the auditor should have been created - assert dataFrameAuditor.get() != null; - assert dataFrameTransformsCheckpointService.get() != null; + assert transformAuditor.get() != null; + assert transformCheckpointService.get() != null; return Collections.singletonList( - new DataFrameTransformPersistentTasksExecutor(client, - dataFrameTransformsConfigManager.get(), - dataFrameTransformsCheckpointService.get(), + new TransformPersistentTasksExecutor(client, + transformsConfigManager.get(), + transformCheckpointService.get(), schedulerEngine.get(), - dataFrameAuditor.get(), + transformAuditor.get(), threadPool, clusterService, settingsModule.getSettings())); @@ -224,7 +224,7 @@ public List> getPersistentTasksExecutor(ClusterServic @Override public List> getSettings() { - return Collections.singletonList(DataFrameTransformTask.NUM_FAILURE_RETRIES_SETTING); + return Collections.singletonList(TransformTask.NUM_FAILURE_RETRIES_SETTING); } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/DataFrameInfoTransportAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/TransformInfoTransportAction.java similarity index 90% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/DataFrameInfoTransportAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/TransformInfoTransportAction.java index ae69fae6856af..c940a1329e13b 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/DataFrameInfoTransportAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/TransformInfoTransportAction.java @@ -31,19 +31,19 @@ import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.transforms.TransformIndexerStats; import org.elasticsearch.xpack.core.transform.transforms.TransformStoredDoc; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class DataFrameInfoTransportAction extends XPackInfoFeatureTransportAction { +public class TransformInfoTransportAction extends XPackInfoFeatureTransportAction { private final boolean enabled; private final XPackLicenseState licenseState; - private static final Logger logger = LogManager.getLogger(DataFrameInfoTransportAction.class); + private static final Logger logger = LogManager.getLogger(TransformInfoTransportAction.class); public static final String[] PROVIDED_STATS = new String[] { TransformIndexerStats.NUM_PAGES.getPreferredName(), @@ -59,21 +59,21 @@ public class DataFrameInfoTransportAction extends XPackInfoFeatureTransportActio }; @Inject - public DataFrameInfoTransportAction(TransportService transportService, ActionFilters actionFilters, + public TransformInfoTransportAction(TransportService transportService, ActionFilters actionFilters, Settings settings, XPackLicenseState licenseState) { - super(XPackInfoFeatureAction.DATA_FRAME.name(), transportService, actionFilters); - this.enabled = XPackSettings.DATA_FRAME_ENABLED.get(settings); + super(XPackInfoFeatureAction.TRANSFORM.name(), transportService, actionFilters); + this.enabled = XPackSettings.TRANSFORM_ENABLED.get(settings); this.licenseState = licenseState; } @Override public String name() { - return XPackField.Transform; + return XPackField.TRANSFORM; } @Override public boolean available() { - return licenseState.isDataFrameAllowed(); + return licenseState.isTransformAllowed(); } @Override @@ -110,7 +110,7 @@ static void getStatisticSummations(Client client, ActionListener listener) { - boolean available = licenseState.isDataFrameAllowed(); + boolean available = licenseState.isTransformAllowed(); if (enabled == false) { var usage = new TransformFeatureSetUsage(available, enabled, Collections.emptyMap(), new TransformIndexerStats()); listener.onResponse(new XPackUsageFeatureResponse(usage)); @@ -75,13 +75,13 @@ protected void masterOperation(Task task, XPackUsageRequest request, ClusterStat } PersistentTasksCustomMetaData taskMetadata = PersistentTasksCustomMetaData.getPersistentTasksCustomMetaData(state); - Collection> dataFrameTasks = taskMetadata == null ? + Collection> transformTasks = taskMetadata == null ? Collections.emptyList() : - taskMetadata.findTasks(Transform.NAME, (t) -> true); - final int taskCount = dataFrameTasks.size(); + taskMetadata.findTasks(TransformTaskParams.NAME, (t) -> true); + final int taskCount = transformTasks.size(); final Map transformsCountByState = new HashMap<>(); - for(PersistentTasksCustomMetaData.PersistentTask dataFrameTask : dataFrameTasks) { - TransformState transformState = (TransformState)dataFrameTask.getState(); + for(PersistentTasksCustomMetaData.PersistentTask transformTask : transformTasks) { + TransformState transformState = (TransformState)transformTask.getState(); transformsCountByState.merge(transformState.getTaskState().value(), 1L, Long::sum); } @@ -107,25 +107,25 @@ protected void masterOperation(Task task, XPackUsageRequest request, ClusterStat return; } transformsCountByState.merge(TransformTaskState.STOPPED.value(), totalTransforms - taskCount, Long::sum); - DataFrameInfoTransportAction.getStatisticSummations(client, totalStatsListener); + TransformInfoTransportAction.getStatisticSummations(client, totalStatsListener); }, transformCountFailure -> { if (transformCountFailure instanceof ResourceNotFoundException) { - DataFrameInfoTransportAction.getStatisticSummations(client, totalStatsListener); + TransformInfoTransportAction.getStatisticSummations(client, totalStatsListener); } else { listener.onFailure(transformCountFailure); } } ); - SearchRequest totalTransformCount = client.prepareSearch(DataFrameInternalIndex.INDEX_NAME_PATTERN) + SearchRequest totalTransformCount = client.prepareSearch(TransformInternalIndex.INDEX_NAME_PATTERN) .setTrackTotalHits(true) .setQuery(QueryBuilders.constantScoreQuery(QueryBuilders.boolQuery() .filter(QueryBuilders.termQuery(TransformField.INDEX_DOC_TYPE.getPreferredName(), TransformConfig.NAME)))) .request(); ClientHelper.executeAsyncWithOrigin(client.threadPool().getThreadContext(), - ClientHelper.DATA_FRAME_ORIGIN, + ClientHelper.TRANSFORM_ORIGIN, totalTransformCount, totalTransformCountListener, client::search); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/DataFrameNodes.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransformNodes.java similarity index 76% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/DataFrameNodes.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransformNodes.java index e22a67d165808..b05065f3a3493 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/DataFrameNodes.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransformNodes.java @@ -15,19 +15,19 @@ import java.util.List; import java.util.Set; -public final class DataFrameNodes { +public final class TransformNodes { - private DataFrameNodes() { + private TransformNodes() { } /** - * Get the list of nodes the data frames are executing on + * Get the list of nodes transforms are executing on * - * @param dataFrameIds The data frames. + * @param transformIds The transforms. * @param clusterState State * @return The executor nodes */ - public static String[] dataFrameTaskNodes(List dataFrameIds, ClusterState clusterState) { + public static String[] transformTaskNodes(List transformIds, ClusterState clusterState) { Set executorNodes = new HashSet<>(); @@ -35,10 +35,10 @@ public static String[] dataFrameTaskNodes(List dataFrameIds, ClusterStat PersistentTasksCustomMetaData.getPersistentTasksCustomMetaData(clusterState); if (tasksMetaData != null) { - Set dataFrameIdsSet = new HashSet<>(dataFrameIds); + Set transformIdsSet = new HashSet<>(transformIds); Collection> tasks = - tasksMetaData.findTasks(TransformField.TASK_NAME, t -> dataFrameIdsSet.contains(t.getId())); + tasksMetaData.findTasks(TransformField.TASK_NAME, t -> transformIdsSet.contains(t.getId())); for (PersistentTasksCustomMetaData.PersistentTask task : tasks) { executorNodes.add(task.getExecutorNode()); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteTransformAction.java similarity index 83% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteTransformAction.java index 60740e0fe35b2..7ec128a3fccd5 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteTransformAction.java @@ -26,24 +26,24 @@ import org.elasticsearch.xpack.core.transform.action.DeleteTransformAction; import org.elasticsearch.xpack.core.transform.action.StopTransformAction; import org.elasticsearch.xpack.core.transform.action.DeleteTransformAction.Request; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import java.io.IOException; -import static org.elasticsearch.xpack.core.ClientHelper.DATA_FRAME_ORIGIN; +import static org.elasticsearch.xpack.core.ClientHelper.TRANSFORM_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; -public class TransportDeleteDataFrameTransformAction extends TransportMasterNodeAction { +public class TransportDeleteTransformAction extends TransportMasterNodeAction { - private final DataFrameTransformsConfigManager transformsConfigManager; - private final DataFrameAuditor auditor; + private final TransformConfigManager transformsConfigManager; + private final TransformAuditor auditor; private final Client client; @Inject - public TransportDeleteDataFrameTransformAction(TransportService transportService, ActionFilters actionFilters, ThreadPool threadPool, + public TransportDeleteTransformAction(TransportService transportService, ActionFilters actionFilters, ThreadPool threadPool, ClusterService clusterService, IndexNameExpressionResolver indexNameExpressionResolver, - DataFrameTransformsConfigManager transformsConfigManager, DataFrameAuditor auditor, + TransformConfigManager transformsConfigManager, TransformAuditor auditor, Client client) { super(DeleteTransformAction.NAME, transportService, clusterService, threadPool, actionFilters, Request::new, indexNameExpressionResolver); @@ -67,14 +67,14 @@ protected void masterOperation(Task task, Request request, ClusterState state, ActionListener listener) { final PersistentTasksCustomMetaData pTasksMeta = state.getMetaData().custom(PersistentTasksCustomMetaData.TYPE); if (pTasksMeta != null && pTasksMeta.getTask(request.getId()) != null && request.isForce() == false) { - listener.onFailure(new ElasticsearchStatusException("Cannot delete data frame [" + request.getId() + + listener.onFailure(new ElasticsearchStatusException("Cannot delete transform [" + request.getId() + "] as the task is running. Stop the task first", RestStatus.CONFLICT)); } else { ActionListener stopTransformActionListener = ActionListener.wrap( stopResponse -> transformsConfigManager.deleteTransform(request.getId(), ActionListener.wrap( r -> { - auditor.info(request.getId(), "Deleted data frame transform."); + auditor.info(request.getId(), "Deleted transform."); listener.onResponse(new AcknowledgedResponse(r)); }, listener::onFailure)), @@ -83,7 +83,7 @@ protected void masterOperation(Task task, Request request, ClusterState state, if (pTasksMeta != null && pTasksMeta.getTask(request.getId()) != null) { executeAsyncWithOrigin(client, - DATA_FRAME_ORIGIN, + TRANSFORM_ORIGIN, StopTransformAction.INSTANCE, new StopTransformAction.Request(request.getId(), true, true, null, true), ActionListener.wrap( diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetDataFrameTransformsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformsAction.java similarity index 88% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetDataFrameTransformsAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformsAction.java index 7478a11fa9cbc..9ffe5941ee580 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetDataFrameTransformsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformsAction.java @@ -28,17 +28,17 @@ import org.elasticsearch.xpack.core.transform.action.GetTransformsAction.Request; import org.elasticsearch.xpack.core.transform.action.GetTransformsAction.Response; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; import static org.elasticsearch.xpack.core.transform.TransformField.INDEX_DOC_TYPE; -public class TransportGetDataFrameTransformsAction extends AbstractTransportGetResourcesAction { @Inject - public TransportGetDataFrameTransformsAction(TransportService transportService, ActionFilters actionFilters, + public TransportGetTransformsAction(TransportService transportService, ActionFilters actionFilters, Client client, NamedXContentRegistry xContentRegistry) { super(GetTransformsAction.NAME, transportService, actionFilters, Request::new, client, xContentRegistry); } @@ -58,7 +58,7 @@ protected ParseField getResultsField() { @Override protected String[] getIndices() { - return new String[]{DataFrameInternalIndex.INDEX_NAME_PATTERN}; + return new String[]{TransformInternalIndex.INDEX_NAME_PATTERN}; } @Override @@ -69,12 +69,12 @@ protected TransformConfig parse(XContentParser parser) { @Override protected ResourceNotFoundException notFoundException(String resourceId) { return new ResourceNotFoundException( - TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, resourceId)); + TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, resourceId)); } @Override protected String executionOrigin() { - return ClientHelper.DATA_FRAME_ORIGIN; + return ClientHelper.TRANSFORM_ORIGIN; } @Override diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetDataFrameTransformsStatsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformsStatsAction.java similarity index 86% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetDataFrameTransformsStatsAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformsStatsAction.java index 4e293654788cf..c2e6675345c33 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetDataFrameTransformsStatsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformsStatsAction.java @@ -31,9 +31,9 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformStats; import org.elasticsearch.xpack.core.transform.transforms.TransformStoredDoc; import org.elasticsearch.xpack.core.transform.transforms.NodeAttributes; -import org.elasticsearch.xpack.transform.checkpoint.DataFrameTransformsCheckpointService; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; -import org.elasticsearch.xpack.transform.transforms.DataFrameTransformTask; +import org.elasticsearch.xpack.transform.checkpoint.TransformCheckpointService; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; +import org.elasticsearch.xpack.transform.transforms.TransformTask; import java.util.ArrayList; import java.util.Collections; @@ -45,26 +45,26 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; -public class TransportGetDataFrameTransformsStatsAction extends - TransportTasksAction { - private static final Logger logger = LogManager.getLogger(TransportGetDataFrameTransformsStatsAction.class); + private static final Logger logger = LogManager.getLogger(TransportGetTransformsStatsAction.class); - private final DataFrameTransformsConfigManager dataFrameTransformsConfigManager; - private final DataFrameTransformsCheckpointService transformsCheckpointService; + private final TransformConfigManager transformConfigManager; + private final TransformCheckpointService transformCheckpointService; @Inject - public TransportGetDataFrameTransformsStatsAction(TransportService transportService, ActionFilters actionFilters, - ClusterService clusterService, - DataFrameTransformsConfigManager dataFrameTransformsConfigManager, - DataFrameTransformsCheckpointService transformsCheckpointService) { + public TransportGetTransformsStatsAction(TransportService transportService, ActionFilters actionFilters, + ClusterService clusterService, + TransformConfigManager transformsConfigManager, + TransformCheckpointService transformsCheckpointService) { super(GetTransformsStatsAction.NAME, clusterService, transportService, actionFilters, Request::new, Response::new, Response::new, ThreadPool.Names.SAME); - this.dataFrameTransformsConfigManager = dataFrameTransformsConfigManager; - this.transformsCheckpointService = transformsCheckpointService; + this.transformConfigManager = transformsConfigManager; + this.transformCheckpointService = transformsCheckpointService; } @Override @@ -80,13 +80,13 @@ protected Response newResponse(Request request, List tasks, List listener) { + protected void taskOperation(Request request, TransformTask task, ActionListener listener) { // Little extra insurance, make sure we only return transforms that aren't cancelled ClusterState state = clusterService.state(); String nodeId = state.nodes().getLocalNode().getId(); if (task.isCancelled() == false) { TransformState transformState = task.getState(); - task.getCheckpointingInfo(transformsCheckpointService, ActionListener.wrap( + task.getCheckpointingInfo(transformCheckpointService, ActionListener.wrap( checkpointingInfo -> listener.onResponse(new Response( Collections.singletonList(new TransformStats(task.getTransformId(), TransformStats.State.fromComponents(transformState.getTaskState(), transformState.getIndexerState()), @@ -116,13 +116,13 @@ protected void taskOperation(Request request, DataFrameTransformTask task, Actio @Override protected void doExecute(Task task, Request request, ActionListener finalListener) { - dataFrameTransformsConfigManager.expandTransformIds(request.getId(), + transformConfigManager.expandTransformIds(request.getId(), request.getPageParams(), request.isAllowNoMatch(), ActionListener.wrap(hitsAndIds -> { request.setExpandedIds(hitsAndIds.v2()); final ClusterState state = clusterService.state(); - request.setNodes(DataFrameNodes.dataFrameTaskNodes(hitsAndIds.v2(), state)); + request.setNodes(TransformNodes.transformTaskNodes(hitsAndIds.v2(), state)); super.doExecute(task, request, ActionListener.wrap( response -> { PersistentTasksCustomMetaData tasksInProgress = state.getMetaData().custom(PersistentTasksCustomMetaData.TYPE); @@ -152,11 +152,11 @@ protected void doExecute(Task task, Request request, ActionListener fi )); } - private static void setNodeAttributes(TransformStats dataFrameTransformStats, + private static void setNodeAttributes(TransformStats transformStats, PersistentTasksCustomMetaData persistentTasksCustomMetaData, ClusterState state) { - var pTask = persistentTasksCustomMetaData.getTask(dataFrameTransformStats.getId()); + var pTask = persistentTasksCustomMetaData.getTask(transformStats.getId()); if (pTask != null) { - dataFrameTransformStats.setNode(NodeAttributes.fromDiscoveryNode(state.nodes().get(pTask.getExecutorNode()))); + transformStats.setNode(NodeAttributes.fromDiscoveryNode(state.nodes().get(pTask.getExecutorNode()))); } } @@ -212,12 +212,12 @@ private void collectStatsForTransformsWithoutTasks(Request request, } ); - dataFrameTransformsConfigManager.getTransformStoredDoc(transformsWithoutTasks, searchStatsListener); + transformConfigManager.getTransformStoredDoc(transformsWithoutTasks, searchStatsListener); } private void populateSingleStoppedTransformStat(TransformStoredDoc transform, ActionListener listener) { - transformsCheckpointService.getCheckpointingInfo( + transformCheckpointService.getCheckpointingInfo( transform.getId(), transform.getTransformState().getCheckpoint(), transform.getTransformState().getPosition(), diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewTransformAction.java similarity index 93% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewTransformAction.java index f736fed4a0977..8780f1baa0a04 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewTransformAction.java @@ -55,12 +55,12 @@ import java.util.stream.Collectors; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.transform.transforms.DataFrameIndexer.COMPOSITE_AGGREGATION_NAME; +import static org.elasticsearch.xpack.transform.transforms.TransformIndexer.COMPOSITE_AGGREGATION_NAME; -public class TransportPreviewDataFrameTransformAction extends +public class TransportPreviewTransformAction extends HandledTransportAction { - private static final Logger logger = LogManager.getLogger(TransportPreviewDataFrameTransformAction.class); + private static final Logger logger = LogManager.getLogger(TransportPreviewTransformAction.class); private static final int NUMBER_OF_PREVIEW_BUCKETS = 100; private final XPackLicenseState licenseState; private final Client client; @@ -69,7 +69,7 @@ public class TransportPreviewDataFrameTransformAction extends private final ClusterService clusterService; @Inject - public TransportPreviewDataFrameTransformAction(TransportService transportService, ActionFilters actionFilters, + public TransportPreviewTransformAction(TransportService transportService, ActionFilters actionFilters, Client client, ThreadPool threadPool, XPackLicenseState licenseState, IndexNameExpressionResolver indexNameExpressionResolver, ClusterService clusterService) { @@ -85,8 +85,8 @@ public TransportPreviewDataFrameTransformAction(TransportService transportServic protected void doExecute(Task task, PreviewTransformAction.Request request, ActionListener listener) { - if (!licenseState.isDataFrameAllowed()) { - listener.onFailure(LicenseUtils.newComplianceException(XPackField.Transform)); + if (!licenseState.isTransformAllowed()) { + listener.onFailure(LicenseUtils.newComplianceException(XPackField.TRANSFORM)); return; } @@ -97,7 +97,7 @@ protected void doExecute(Task task, String[] concreteNames = indexNameExpressionResolver.concreteIndexNames(clusterState, IndicesOptions.lenientExpandOpen(), src); if (concreteNames.length == 0) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_SOURCE_INDEX_MISSING, src), + TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_SOURCE_INDEX_MISSING, src), RestStatus.BAD_REQUEST)); return; } @@ -108,13 +108,13 @@ protected void doExecute(Task task, pivot.validateConfig(); } catch (ElasticsearchStatusException e) { listener.onFailure( - new ElasticsearchStatusException(TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, + new ElasticsearchStatusException(TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, e.status(), e)); return; } catch (Exception e) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, RestStatus.INTERNAL_SERVER_ERROR, e)); + TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, RestStatus.INTERNAL_SERVER_ERROR, e)); return; } @@ -149,7 +149,7 @@ private void getPreview(Pivot pivot, deducedMappings -> { previewResponse.setMappingsFromStringMap(deducedMappings); ClientHelper.executeWithHeadersAsync(threadPool.getThreadContext().getHeaders(), - ClientHelper.DATA_FRAME_ORIGIN, + ClientHelper.TRANSFORM_ORIGIN, client, SearchAction.INSTANCE, pivot.buildSearchRequest(source, null, NUMBER_OF_PREVIEW_BUCKETS), @@ -192,7 +192,7 @@ private void getPreview(Pivot pivot, var pipelineRequest = new SimulatePipelineRequest(BytesReference.bytes(builder), XContentType.JSON); pipelineRequest.setId(pipeline); ClientHelper.executeAsyncWithOrigin(client, - ClientHelper.DATA_FRAME_ORIGIN, + ClientHelper.TRANSFORM_ORIGIN, SimulatePipelineAction.INSTANCE, pipelineRequest, pipelineResponseActionListener); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutTransformAction.java similarity index 82% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutTransformAction.java index 9f9aed8214b3d..36309526f17e5 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutTransformAction.java @@ -46,8 +46,8 @@ import org.elasticsearch.xpack.core.transform.action.PutTransformAction; import org.elasticsearch.xpack.core.transform.action.PutTransformAction.Request; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import org.elasticsearch.xpack.transform.transforms.SourceDestValidator; import org.elasticsearch.xpack.transform.transforms.pivot.Pivot; @@ -58,25 +58,25 @@ import java.util.Map; import java.util.stream.Collectors; -public class TransportPutDataFrameTransformAction extends TransportMasterNodeAction { +public class TransportPutTransformAction extends TransportMasterNodeAction { private final XPackLicenseState licenseState; private final Client client; - private final DataFrameTransformsConfigManager dataFrameTransformsConfigManager; + private final TransformConfigManager transformsConfigManager; private final SecurityContext securityContext; - private final DataFrameAuditor auditor; + private final TransformAuditor auditor; @Inject - public TransportPutDataFrameTransformAction(Settings settings, TransportService transportService, ThreadPool threadPool, - ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, - ClusterService clusterService, XPackLicenseState licenseState, - DataFrameTransformsConfigManager dataFrameTransformsConfigManager, Client client, - DataFrameAuditor auditor) { + public TransportPutTransformAction(Settings settings, TransportService transportService, ThreadPool threadPool, + ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, + ClusterService clusterService, XPackLicenseState licenseState, + TransformConfigManager transformsConfigManager, Client client, + TransformAuditor auditor) { super(PutTransformAction.NAME, transportService, clusterService, threadPool, actionFilters, PutTransformAction.Request::new, indexNameExpressionResolver); this.licenseState = licenseState; this.client = client; - this.dataFrameTransformsConfigManager = dataFrameTransformsConfigManager; + this.transformsConfigManager = transformsConfigManager; this.securityContext = XPackSettings.SECURITY_ENABLED.get(settings) ? new SecurityContext(settings, threadPool.getThreadContext()) : null; this.auditor = auditor; @@ -134,14 +134,14 @@ protected AcknowledgedResponse read(StreamInput in) throws IOException { @Override protected void masterOperation(Task task, Request request, ClusterState clusterState, ActionListener listener) { - if (!licenseState.isDataFrameAllowed()) { - listener.onFailure(LicenseUtils.newComplianceException(XPackField.Transform)); + if (!licenseState.isTransformAllowed()) { + listener.onFailure(LicenseUtils.newComplianceException(XPackField.TRANSFORM)); return; } XPackPlugin.checkReadyForXPackCustomMetadata(clusterState); - // set headers to run data frame transform as calling user + // set headers to run transform as calling user Map filteredHeaders = threadPool.getThreadContext().getHeaders().entrySet().stream() .filter(e -> ClientHelper.SECURITY_HEADER_FILTERS.contains(e.getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); @@ -155,7 +155,7 @@ protected void masterOperation(Task task, Request request, ClusterState clusterS // quick check whether a transform has already been created under that name if (PersistentTasksCustomMetaData.getTaskWithId(clusterState, transformId) != null) { listener.onFailure(new ResourceAlreadyExistsException( - TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_TRANSFORM_EXISTS, transformId))); + TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_EXISTS, transformId))); return; } try { @@ -175,7 +175,7 @@ protected void masterOperation(Task task, Request request, ClusterState clusterS client.execute(HasPrivilegesAction.INSTANCE, privRequest, privResponseListener); } else { // No security enabled, just create the transform - putDataFrame(request, listener); + putTransform(request, listener); } } @@ -189,7 +189,7 @@ private void handlePrivsResponse(String username, HasPrivilegesResponse privilegesResponse, ActionListener listener) { if (privilegesResponse.isCompleteMatch()) { - putDataFrame(request, listener); + putTransform(request, listener); } else { List indices = privilegesResponse.getIndexPrivileges() .stream() @@ -197,14 +197,14 @@ private void handlePrivsResponse(String username, .collect(Collectors.toList()); listener.onFailure(Exceptions.authorizationError( - "Cannot create data frame transform [{}] because user {} lacks all the required permissions for indices: {}", + "Cannot create transform [{}] because user {} lacks all the required permissions for indices: {}", request.getConfig().getId(), username, indices)); } } - private void putDataFrame(Request request, ActionListener listener) { + private void putTransform(Request request, ActionListener listener) { final TransformConfig config = request.getConfig(); final Pivot pivot = new Pivot(config.getPivotConfig()); @@ -212,7 +212,7 @@ private void putDataFrame(Request request, ActionListener // <3> Return to the listener ActionListener putTransformConfigurationListener = ActionListener.wrap( putTransformConfigurationResult -> { - auditor.info(config.getId(), "Created data frame transform."); + auditor.info(config.getId(), "Created transform."); listener.onResponse(new AcknowledgedResponse(true)); }, listener::onFailure @@ -220,16 +220,16 @@ private void putDataFrame(Request request, ActionListener // <2> Put our transform ActionListener pivotValidationListener = ActionListener.wrap( - validationResult -> dataFrameTransformsConfigManager.putTransformConfiguration(config, putTransformConfigurationListener), + validationResult -> transformsConfigManager.putTransformConfiguration(config, putTransformConfigurationListener), validationException -> { if (validationException instanceof ElasticsearchStatusException) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, + TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, ((ElasticsearchStatusException)validationException).status(), validationException)); } else { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, + TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, RestStatus.INTERNAL_SERVER_ERROR, validationException)); } @@ -240,13 +240,13 @@ private void putDataFrame(Request request, ActionListener pivot.validateConfig(); } catch (ElasticsearchStatusException e) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, + TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, e.status(), e)); return; } catch (Exception e) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, RestStatus.INTERNAL_SERVER_ERROR, e)); + TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, RestStatus.INTERNAL_SERVER_ERROR, e)); return; } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartTransformAction.java similarity index 80% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartTransformAction.java index cc646906cfb7c..af35d3704f276 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStartTransformAction.java @@ -37,13 +37,13 @@ import org.elasticsearch.xpack.core.XPackField; import org.elasticsearch.xpack.core.transform.TransformMessages; import org.elasticsearch.xpack.core.transform.action.StartTransformAction; -import org.elasticsearch.xpack.core.transform.transforms.Transform; +import org.elasticsearch.xpack.core.transform.transforms.TransformTaskParams; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformState; import org.elasticsearch.xpack.core.transform.transforms.TransformTaskState; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; -import org.elasticsearch.xpack.transform.persistence.DataframeIndex; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; +import org.elasticsearch.xpack.transform.persistence.TransformIndex; import org.elasticsearch.xpack.transform.transforms.SourceDestValidator; import org.elasticsearch.xpack.transform.transforms.pivot.Pivot; @@ -55,29 +55,29 @@ import java.util.function.Consumer; import java.util.function.Predicate; -import static org.elasticsearch.xpack.core.transform.TransformMessages.DATA_FRAME_CANNOT_START_FAILED_TRANSFORM; +import static org.elasticsearch.xpack.core.transform.TransformMessages.CANNOT_START_FAILED_TRANSFORM; -public class TransportStartDataFrameTransformAction extends +public class TransportStartTransformAction extends TransportMasterNodeAction { - private static final Logger logger = LogManager.getLogger(TransportStartDataFrameTransformAction.class); + private static final Logger logger = LogManager.getLogger(TransportStartTransformAction.class); private final XPackLicenseState licenseState; - private final DataFrameTransformsConfigManager dataFrameTransformsConfigManager; + private final TransformConfigManager transformsConfigManager; private final PersistentTasksService persistentTasksService; private final Client client; - private final DataFrameAuditor auditor; + private final TransformAuditor auditor; @Inject - public TransportStartDataFrameTransformAction(TransportService transportService, ActionFilters actionFilters, - ClusterService clusterService, XPackLicenseState licenseState, - ThreadPool threadPool, IndexNameExpressionResolver indexNameExpressionResolver, - DataFrameTransformsConfigManager dataFrameTransformsConfigManager, - PersistentTasksService persistentTasksService, Client client, - DataFrameAuditor auditor) { + public TransportStartTransformAction(TransportService transportService, ActionFilters actionFilters, + ClusterService clusterService, XPackLicenseState licenseState, + ThreadPool threadPool, IndexNameExpressionResolver indexNameExpressionResolver, + TransformConfigManager transformsConfigManager, + PersistentTasksService persistentTasksService, Client client, + TransformAuditor auditor) { super(StartTransformAction.NAME, transportService, clusterService, threadPool, actionFilters, StartTransformAction.Request::new, indexNameExpressionResolver); this.licenseState = licenseState; - this.dataFrameTransformsConfigManager = dataFrameTransformsConfigManager; + this.transformsConfigManager = transformsConfigManager; this.persistentTasksService = persistentTasksService; this.client = client; this.auditor = auditor; @@ -97,19 +97,19 @@ protected StartTransformAction.Response read(StreamInput in) throws IOException protected void masterOperation(Task ignoredTask, StartTransformAction.Request request, ClusterState state, ActionListener listener) throws Exception { - if (!licenseState.isDataFrameAllowed()) { - listener.onFailure(LicenseUtils.newComplianceException(XPackField.Transform)); + if (!licenseState.isTransformAllowed()) { + listener.onFailure(LicenseUtils.newComplianceException(XPackField.TRANSFORM)); return; } - final AtomicReference transformTaskHolder = new AtomicReference<>(); + final AtomicReference transformTaskHolder = new AtomicReference<>(); // <4> Wait for the allocated task's state to STARTED - ActionListener> newPersistentTaskActionListener = + ActionListener> newPersistentTaskActionListener = ActionListener.wrap( task -> { - Transform transformTask = transformTaskHolder.get(); + TransformTaskParams transformTask = transformTaskHolder.get(); assert transformTask != null; - waitForDataFrameTaskStarted(task.getId(), + waitForTransformTaskStarted(task.getId(), transformTask, request.timeout(), ActionListener.wrap( @@ -122,21 +122,21 @@ protected void masterOperation(Task ignoredTask, StartTransformAction.Request re // <3> Create the task in cluster state so that it will start executing on the node ActionListener createOrGetIndexListener = ActionListener.wrap( unused -> { - Transform transformTask = transformTaskHolder.get(); + TransformTaskParams transformTask = transformTaskHolder.get(); assert transformTask != null; - PersistentTasksCustomMetaData.PersistentTask existingTask = + PersistentTasksCustomMetaData.PersistentTask existingTask = getExistingTask(transformTask.getId(), state); if (existingTask == null) { // Create the allocated task and wait for it to be started persistentTasksService.sendStartRequest(transformTask.getId(), - Transform.NAME, + TransformTaskParams.NAME, transformTask, newPersistentTaskActionListener); } else { TransformState transformState = (TransformState)existingTask.getState(); if(transformState.getTaskState() == TransformTaskState.FAILED) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.getMessage(DATA_FRAME_CANNOT_START_FAILED_TRANSFORM, + TransformMessages.getMessage(CANNOT_START_FAILED_TRANSFORM, request.getId(), transformState.getReason()), RestStatus.CONFLICT)); @@ -159,7 +159,7 @@ protected void masterOperation(Task ignoredTask, StartTransformAction.Request re config -> { if (config.isValid() == false) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.getMessage(TransformMessages.DATA_FRAME_CONFIG_INVALID, request.getId()), + TransformMessages.getMessage(TransformMessages.TRANSFORM_CONFIG_INVALID, request.getId()), RestStatus.BAD_REQUEST )); return; @@ -167,7 +167,7 @@ protected void masterOperation(Task ignoredTask, StartTransformAction.Request re // Validate source and destination indices SourceDestValidator.validate(config, clusterService.state(), indexNameExpressionResolver, false); - transformTaskHolder.set(createDataFrameTransform(config.getId(), config.getVersion(), config.getFrequency())); + transformTaskHolder.set(createTransform(config.getId(), config.getVersion(), config.getFrequency())); final String destinationIndex = config.getDestination().getIndex(); String[] dest = indexNameExpressionResolver.concreteIndexNames(state, IndicesOptions.lenientExpandOpen(), @@ -180,7 +180,7 @@ protected void masterOperation(Task ignoredTask, StartTransformAction.Request re } else { auditor.info(request.getId(), "Using existing destination index [" + destinationIndex + "]."); ClientHelper.executeAsyncWithOrigin(client.threadPool().getThreadContext(), - ClientHelper.DATA_FRAME_ORIGIN, + ClientHelper.TRANSFORM_ORIGIN, client.admin() .indices() .prepareStats(dest) @@ -209,7 +209,7 @@ protected void masterOperation(Task ignoredTask, StartTransformAction.Request re ); // <1> Get the config to verify it exists and is valid - dataFrameTransformsConfigManager.getTransformConfiguration(request.getId(), getTransformListener); + transformsConfigManager.getTransformConfiguration(request.getId(), getTransformListener); } private void createDestinationIndex(final TransformConfig config, final ActionListener listener) { @@ -217,14 +217,14 @@ private void createDestinationIndex(final TransformConfig config, final ActionLi final Pivot pivot = new Pivot(config.getPivotConfig()); ActionListener> deduceMappingsListener = ActionListener.wrap( - mappings -> DataframeIndex.createDestinationIndex( + mappings -> TransformIndex.createDestinationIndex( client, Clock.systemUTC(), config, mappings, ActionListener.wrap(r -> listener.onResponse(null), listener::onFailure)), deduceTargetMappingsException -> listener.onFailure( - new RuntimeException(TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_DEDUCE_DEST_MAPPINGS, + new RuntimeException(TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_DEDUCE_DEST_MAPPINGS, deduceTargetMappingsException)) ); @@ -236,44 +236,44 @@ protected ClusterBlockException checkBlock(StartTransformAction.Request request, return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE); } - private static Transform createDataFrameTransform(String transformId, Version transformVersion, TimeValue frequency) { - return new Transform(transformId, transformVersion, frequency); + private static TransformTaskParams createTransform(String transformId, Version transformVersion, TimeValue frequency) { + return new TransformTaskParams(transformId, transformVersion, frequency); } @SuppressWarnings("unchecked") - private static PersistentTasksCustomMetaData.PersistentTask getExistingTask(String id, ClusterState state) { + private static PersistentTasksCustomMetaData.PersistentTask getExistingTask(String id, ClusterState state) { PersistentTasksCustomMetaData pTasksMeta = state.getMetaData().custom(PersistentTasksCustomMetaData.TYPE); if (pTasksMeta == null) { return null; } - Collection> existingTask = pTasksMeta.findTasks(Transform.NAME, + Collection> existingTask = pTasksMeta.findTasks(TransformTaskParams.NAME, t -> t.getId().equals(id)); if (existingTask.isEmpty()) { return null; } else { assert(existingTask.size() == 1); PersistentTasksCustomMetaData.PersistentTask pTask = existingTask.iterator().next(); - if (pTask.getParams() instanceof Transform) { - return (PersistentTasksCustomMetaData.PersistentTask)pTask; + if (pTask.getParams() instanceof TransformTaskParams) { + return (PersistentTasksCustomMetaData.PersistentTask)pTask; } - throw new ElasticsearchStatusException("Found data frame transform persistent task [" + id + "] with incorrect params", + throw new ElasticsearchStatusException("Found transform persistent task [" + id + "] with incorrect params", RestStatus.INTERNAL_SERVER_ERROR); } } - private void cancelDataFrameTask(String taskId, String dataFrameId, Exception exception, Consumer onFailure) { + private void cancelTransformTask(String taskId, String transformId, Exception exception, Consumer onFailure) { persistentTasksService.sendRemoveRequest(taskId, new ActionListener>() { @Override public void onResponse(PersistentTasksCustomMetaData.PersistentTask task) { - // We succeeded in cancelling the persistent task, but the + // We succeeded in canceling the persistent task, but the // problem that caused us to cancel it is the overall result onFailure.accept(exception); } @Override public void onFailure(Exception e) { - logger.error("[" + dataFrameId + "] Failed to cancel persistent task that could " + + logger.error("[" + transformId + "] Failed to cancel persistent task that could " + "not be assigned due to [" + exception.getMessage() + "]", e); onFailure.accept(exception); } @@ -281,19 +281,19 @@ public void onFailure(Exception e) { ); } - private void waitForDataFrameTaskStarted(String taskId, - Transform params, + private void waitForTransformTaskStarted(String taskId, + TransformTaskParams params, TimeValue timeout, ActionListener listener) { - DataFramePredicate predicate = new DataFramePredicate(); + TransformPredicate predicate = new TransformPredicate(); persistentTasksService.waitForPersistentTaskCondition(taskId, predicate, timeout, - new PersistentTasksService.WaitForPersistentTaskListener() { + new PersistentTasksService.WaitForPersistentTaskListener() { @Override - public void onResponse(PersistentTasksCustomMetaData.PersistentTask + public void onResponse(PersistentTasksCustomMetaData.PersistentTask persistentTask) { if (predicate.exception != null) { // We want to return to the caller without leaving an unassigned persistent task - cancelDataFrameTask(taskId, params.getId(), predicate.exception, listener::onFailure); + cancelTransformTask(taskId, params.getId(), predicate.exception, listener::onFailure); } else { listener.onResponse(true); } @@ -306,7 +306,7 @@ public void onFailure(Exception e) { @Override public void onTimeout(TimeValue timeout) { - listener.onFailure(new ElasticsearchException("Starting dataframe [" + listener.onFailure(new ElasticsearchException("Starting transform [" + params.getId() + "] timed out after [" + timeout + "]")); } }); @@ -316,7 +316,7 @@ public void onTimeout(TimeValue timeout) { * Important: the methods of this class must NOT throw exceptions. If they did then the callers * of endpoints waiting for a condition tested by this predicate would never get a response. */ - private class DataFramePredicate implements Predicate> { + private class TransformPredicate implements Predicate> { private volatile Exception exception; @@ -331,7 +331,7 @@ public boolean test(PersistentTasksCustomMetaData.PersistentTask persistentTa assignment.isAssigned() == false) { // For some reason, the task is not assigned to a node, but is no longer in the `INITIAL_ASSIGNMENT` state // Consider this a failure. - exception = new ElasticsearchStatusException("Could not start dataframe, allocation explanation [" + + exception = new ElasticsearchStatusException("Could not start transform, allocation explanation [" + assignment.getExplanation() + "]", RestStatus.TOO_MANY_REQUESTS); return true; } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopTransformAction.java similarity index 86% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopTransformAction.java index 412a23038dee7..f312b3385783e 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopTransformAction.java @@ -36,9 +36,9 @@ import org.elasticsearch.xpack.core.transform.action.StopTransformAction.Response; import org.elasticsearch.xpack.core.transform.transforms.TransformState; import org.elasticsearch.xpack.core.transform.transforms.TransformTaskState; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; -import org.elasticsearch.xpack.transform.transforms.DataFrameTransformTask; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; +import org.elasticsearch.xpack.transform.transforms.TransformTask; import java.util.ArrayList; import java.util.HashSet; @@ -47,27 +47,27 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import static org.elasticsearch.xpack.core.transform.TransformMessages.DATA_FRAME_CANNOT_STOP_FAILED_TRANSFORM; +import static org.elasticsearch.xpack.core.transform.TransformMessages.CANNOT_STOP_FAILED_TRANSFORM; -public class TransportStopDataFrameTransformAction extends TransportTasksAction { +public class TransportStopTransformAction extends TransportTasksAction { - private static final Logger logger = LogManager.getLogger(TransportStopDataFrameTransformAction.class); + private static final Logger logger = LogManager.getLogger(TransportStopTransformAction.class); private final ThreadPool threadPool; - private final DataFrameTransformsConfigManager dataFrameTransformsConfigManager; + private final TransformConfigManager transformsConfigManager; private final PersistentTasksService persistentTasksService; private final Client client; @Inject - public TransportStopDataFrameTransformAction(TransportService transportService, ActionFilters actionFilters, - ClusterService clusterService, ThreadPool threadPool, - PersistentTasksService persistentTasksService, - DataFrameTransformsConfigManager dataFrameTransformsConfigManager, - Client client) { + public TransportStopTransformAction(TransportService transportService, ActionFilters actionFilters, + ClusterService clusterService, ThreadPool threadPool, + PersistentTasksService persistentTasksService, + TransformConfigManager transformsConfigManager, + Client client) { super(StopTransformAction.NAME, clusterService, transportService, actionFilters, Request::new, Response::new, Response::new, ThreadPool.Names.SAME); this.threadPool = threadPool; - this.dataFrameTransformsConfigManager = dataFrameTransformsConfigManager; + this.transformsConfigManager = transformsConfigManager; this.persistentTasksService = persistentTasksService; this.client = client; } @@ -88,11 +88,11 @@ static void validateTaskState(ClusterState state, List transformIds, boo } if (failedTasks.isEmpty() == false) { String msg = failedTasks.size() == 1 ? - TransformMessages.getMessage(DATA_FRAME_CANNOT_STOP_FAILED_TRANSFORM, + TransformMessages.getMessage(CANNOT_STOP_FAILED_TRANSFORM, failedTasks.get(0), failedReasons.get(0)) : - "Unable to stop data frame transforms. The following transforms are in a failed state " + - failedTasks + " with reasons " + failedReasons + ". Use force stop to stop the data frame transforms."; + "Unable to stop transforms. The following transforms are in a failed state " + + failedTasks + " with reasons " + failedReasons + ". Use force stop to stop the transforms."; throw new ElasticsearchStatusException(msg, RestStatus.CONFLICT); } } @@ -103,7 +103,7 @@ protected void doExecute(Task task, Request request, ActionListener li final ClusterState state = clusterService.state(); final DiscoveryNodes nodes = state.nodes(); if (nodes.isLocalNodeElectedMaster() == false) { - // Delegates stop data frame to elected master node so it becomes the coordinating node. + // Delegates stop transform to elected master node so it becomes the coordinating node. if (nodes.getMasterNode() == null) { listener.onFailure(new MasterNotDiscoveredException("no known master node")); } else { @@ -118,13 +118,13 @@ protected void doExecute(Task task, Request request, ActionListener li finalListener = listener; } - dataFrameTransformsConfigManager.expandTransformIds(request.getId(), + transformsConfigManager.expandTransformIds(request.getId(), new PageParams(0, 10_000), request.isAllowNoMatch(), ActionListener.wrap(hitsAndIds -> { validateTaskState(state, hitsAndIds.v2(), request.isForce()); request.setExpandedIds(new HashSet<>(hitsAndIds.v2())); - request.setNodes(DataFrameNodes.dataFrameTaskNodes(hitsAndIds.v2(), state)); + request.setNodes(TransformNodes.transformTaskNodes(hitsAndIds.v2(), state)); super.doExecute(task, request, finalListener); }, listener::onFailure @@ -133,7 +133,7 @@ protected void doExecute(Task task, Request request, ActionListener li } @Override - protected void taskOperation(Request request, DataFrameTransformTask transformTask, ActionListener listener) { + protected void taskOperation(Request request, TransformTask transformTask, ActionListener listener) { Set ids = request.getExpandedIds(); if (ids == null) { @@ -150,7 +150,7 @@ protected void taskOperation(Request request, DataFrameTransformTask transformTa } listener.onResponse(new Response(Boolean.TRUE)); } else { - listener.onFailure(new RuntimeException("ID of data frame indexer task [" + transformTask.getTransformId() + listener.onFailure(new RuntimeException("ID of transform task [" + transformTask.getTransformId() + "] does not match request's ID [" + request.getId() + "]")); } } @@ -175,7 +175,7 @@ private ActionListener waitForStopListener(Request request, ActionList waitResponse -> client.admin() .indices() - .prepareRefresh(DataFrameInternalIndex.LATEST_INDEX_NAME) + .prepareRefresh(TransformInternalIndex.LATEST_INDEX_NAME) .execute(ActionListener.wrap( r -> listener.onResponse(waitResponse), e -> { @@ -190,13 +190,13 @@ private ActionListener waitForStopListener(Request request, ActionList // Wait until the persistent task is stopped // Switch over to Generic threadpool so we don't block the network thread threadPool.generic().execute(() -> - waitForDataFrameStopped(request.getExpandedIds(), request.getTimeout(), request.isForce(), onStopListener)); + waitForTransformStopped(request.getExpandedIds(), request.getTimeout(), request.isForce(), onStopListener)); }, listener::onFailure ); } - private void waitForDataFrameStopped(Set persistentTaskIds, + private void waitForTransformStopped(Set persistentTaskIds, TimeValue timeout, boolean force, ActionListener listener) { @@ -217,7 +217,7 @@ private void waitForDataFrameStopped(Set persistentTaskIds, TransformState taskState = (TransformState)transformsTask.getState(); if (force == false && taskState != null && taskState.getTaskState() == TransformTaskState.FAILED) { exceptions.put(persistentTaskId, new ElasticsearchStatusException( - TransformMessages.getMessage(DATA_FRAME_CANNOT_STOP_FAILED_TRANSFORM, + TransformMessages.getMessage(CANNOT_STOP_FAILED_TRANSFORM, persistentTaskId, taskState.getReason()), RestStatus.CONFLICT)); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java similarity index 82% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java index d2a5512d686b6..815910efe8bfd 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java @@ -46,9 +46,9 @@ import org.elasticsearch.xpack.core.transform.action.UpdateTransformAction.Response; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformConfigUpdate; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; -import org.elasticsearch.xpack.transform.persistence.DataframeIndex; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; +import org.elasticsearch.xpack.transform.persistence.TransformIndex; import org.elasticsearch.xpack.transform.persistence.SeqNoPrimaryTermAndIndex; import org.elasticsearch.xpack.transform.transforms.SourceDestValidator; import org.elasticsearch.xpack.transform.transforms.pivot.Pivot; @@ -59,28 +59,28 @@ import java.util.Map; import java.util.stream.Collectors; -import static org.elasticsearch.xpack.transform.action.TransportPutDataFrameTransformAction.buildPrivilegeCheck; +import static org.elasticsearch.xpack.transform.action.TransportPutTransformAction.buildPrivilegeCheck; -public class TransportUpdateDataFrameTransformAction extends TransportMasterNodeAction { +public class TransportUpdateTransformAction extends TransportMasterNodeAction { - private static final Logger logger = LogManager.getLogger(TransportUpdateDataFrameTransformAction.class); + private static final Logger logger = LogManager.getLogger(TransportUpdateTransformAction.class); private final XPackLicenseState licenseState; private final Client client; - private final DataFrameTransformsConfigManager dataFrameTransformsConfigManager; + private final TransformConfigManager transformsConfigManager; private final SecurityContext securityContext; - private final DataFrameAuditor auditor; + private final TransformAuditor auditor; @Inject - public TransportUpdateDataFrameTransformAction(Settings settings, TransportService transportService, ThreadPool threadPool, - ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, - ClusterService clusterService, XPackLicenseState licenseState, - DataFrameTransformsConfigManager dataFrameTransformsConfigManager, Client client, - DataFrameAuditor auditor) { + public TransportUpdateTransformAction(Settings settings, TransportService transportService, ThreadPool threadPool, + ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, + ClusterService clusterService, XPackLicenseState licenseState, + TransformConfigManager transformsConfigManager, Client client, + TransformAuditor auditor) { super(UpdateTransformAction.NAME, transportService, clusterService, threadPool, actionFilters, Request::new, indexNameExpressionResolver); this.licenseState = licenseState; this.client = client; - this.dataFrameTransformsConfigManager = dataFrameTransformsConfigManager; + this.transformsConfigManager = transformsConfigManager; this.securityContext = XPackSettings.SECURITY_ENABLED.get(settings) ? new SecurityContext(settings, threadPool.getThreadContext()) : null; this.auditor = auditor; @@ -99,14 +99,14 @@ protected Response read(StreamInput in) throws IOException { @Override protected void masterOperation(Task task, Request request, ClusterState clusterState, ActionListener listener) { - if (!licenseState.isDataFrameAllowed()) { - listener.onFailure(LicenseUtils.newComplianceException(XPackField.Transform)); + if (!licenseState.isTransformAllowed()) { + listener.onFailure(LicenseUtils.newComplianceException(XPackField.TRANSFORM)); return; } XPackPlugin.checkReadyForXPackCustomMetadata(clusterState); - // set headers to run data frame transform as calling user + // set headers to run transform as calling user Map filteredHeaders = threadPool.getThreadContext().getHeaders().entrySet().stream() .filter(e -> ClientHelper.SECURITY_HEADER_FILTERS.contains(e.getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); @@ -116,7 +116,7 @@ protected void masterOperation(Task task, Request request, ClusterState clusterS // GET transform and attempt to update // We don't want the update to complete if the config changed between GET and INDEX - dataFrameTransformsConfigManager.getTransformConfigurationForUpdate(request.getId(), ActionListener.wrap( + transformsConfigManager.getTransformConfigurationForUpdate(request.getId(), ActionListener.wrap( configAndVersion -> { final TransformConfig config = configAndVersion.v1(); // If it is a noop don't bother even writing the doc, save the cycles, just return here. @@ -125,7 +125,7 @@ protected void masterOperation(Task task, Request request, ClusterState clusterS return; } TransformConfig updatedConfig = update.apply(config); - validateAndUpdateDataFrame(request, clusterState, updatedConfig, configAndVersion.v2(), listener); + validateAndUpdateTransform(request, clusterState, updatedConfig, configAndVersion.v2(), listener); }, listener::onFailure )); @@ -144,7 +144,7 @@ private void handlePrivsResponse(String username, HasPrivilegesResponse privilegesResponse, ActionListener listener) { if (privilegesResponse.isCompleteMatch()) { - updateDataFrame(request, config, seqNoPrimaryTermAndIndex, clusterState, listener); + updateTransform(request, config, seqNoPrimaryTermAndIndex, clusterState, listener); } else { List indices = privilegesResponse.getIndexPrivileges() .stream() @@ -152,14 +152,14 @@ private void handlePrivsResponse(String username, .collect(Collectors.toList()); listener.onFailure(Exceptions.authorizationError( - "Cannot update data frame transform [{}] because user {} lacks all the required permissions for indices: {}", + "Cannot update transform [{}] because user {} lacks all the required permissions for indices: {}", request.getId(), username, indices)); } } - private void validateAndUpdateDataFrame(Request request, + private void validateAndUpdateTransform(Request request, ClusterState clusterState, TransformConfig config, SeqNoPrimaryTermAndIndex seqNoPrimaryTermAndIndex, @@ -182,10 +182,10 @@ private void validateAndUpdateDataFrame(Request request, client.execute(HasPrivilegesAction.INSTANCE, privRequest, privResponseListener); } else { // No security enabled, just create the transform - updateDataFrame(request, config, seqNoPrimaryTermAndIndex, clusterState, listener); + updateTransform(request, config, seqNoPrimaryTermAndIndex, clusterState, listener); } } - private void updateDataFrame(Request request, + private void updateTransform(Request request, TransformConfig config, SeqNoPrimaryTermAndIndex seqNoPrimaryTermAndIndex, ClusterState clusterState, @@ -196,8 +196,8 @@ private void updateDataFrame(Request request, // <3> Return to the listener ActionListener putTransformConfigurationListener = ActionListener.wrap( putTransformConfigurationResult -> { - auditor.info(config.getId(), "updated data frame transform."); - dataFrameTransformsConfigManager.deleteOldTransformConfigurations(request.getId(), ActionListener.wrap( + auditor.info(config.getId(), "updated transform."); + transformsConfigManager.deleteOldTransformConfigurations(request.getId(), ActionListener.wrap( r -> { logger.trace("[{}] successfully deleted old transform configurations", request.getId()); listener.onResponse(new Response(config)); @@ -217,7 +217,7 @@ private void updateDataFrame(Request request, // <2> Update our transform ActionListener createDestinationListener = ActionListener.wrap( - createDestResponse -> dataFrameTransformsConfigManager.updateTransformConfiguration(config, + createDestResponse -> transformsConfigManager.updateTransformConfiguration(config, seqNoPrimaryTermAndIndex, putTransformConfigurationListener), listener::onFailure @@ -247,12 +247,12 @@ private void updateDataFrame(Request request, validationException -> { if (validationException instanceof ElasticsearchStatusException) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, + TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, ((ElasticsearchStatusException)validationException).status(), validationException)); } else { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, + TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, RestStatus.INTERNAL_SERVER_ERROR, validationException)); } @@ -263,13 +263,13 @@ private void updateDataFrame(Request request, pivot.validateConfig(); } catch (ElasticsearchStatusException e) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, + TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, e.status(), e)); return; } catch (Exception e) { listener.onFailure(new ElasticsearchStatusException( - TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_VALIDATE_DATA_FRAME_CONFIGURATION, RestStatus.INTERNAL_SERVER_ERROR, e)); + TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_VALIDATE_CONFIGURATION, RestStatus.INTERNAL_SERVER_ERROR, e)); return; } @@ -283,14 +283,14 @@ private void updateDataFrame(Request request, private void createDestination(Pivot pivot, TransformConfig config, ActionListener listener) { ActionListener> deduceMappingsListener = ActionListener.wrap( - mappings -> DataframeIndex.createDestinationIndex( + mappings -> TransformIndex.createDestinationIndex( client, Clock.systemUTC(), config, mappings, ActionListener.wrap(r -> listener.onResponse(null), listener::onFailure)), deduceTargetMappingsException -> listener.onFailure( - new RuntimeException(TransformMessages.REST_PUT_DATA_FRAME_FAILED_TO_DEDUCE_DEST_MAPPINGS, + new RuntimeException(TransformMessages.REST_PUT_TRANSFORM_FAILED_TO_DEDUCE_DEST_MAPPINGS, deduceTargetMappingsException)) ); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/CheckpointProvider.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/CheckpointProvider.java index d928bbcebe9d8..5fca07cef2b0e 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/CheckpointProvider.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/CheckpointProvider.java @@ -26,7 +26,7 @@ public interface CheckpointProvider { void createNextCheckpoint(TransformCheckpoint lastCheckpoint, ActionListener listener); /** - * Determines whether the data frame needs updating + * Determines whether the transform needs updating * * @param lastCheckpoint the last checkpoint * @param listener listener to send the result to @@ -36,7 +36,7 @@ public interface CheckpointProvider { /** * Get checkpoint statistics for a running data frame * - * For running data frames most information is available in-memory. + * For running transforms most information is available in-memory. * * @param lastCheckpoint the last checkpoint * @param nextCheckpoint the next checkpoint @@ -53,7 +53,7 @@ void getCheckpointingInfo(TransformCheckpoint lastCheckpoint, /** * Get checkpoint statistics for a stopped data frame * - * For stopped data frames we need to do lookups in the internal index. + * For stopped transforms we need to do lookups in the internal index. * * @param lastCheckpointNumber the last checkpoint number * @param nextCheckpointPosition position for the next checkpoint diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/DefaultCheckpointProvider.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/DefaultCheckpointProvider.java index 46ca6d4ebe3c7..e624f2e62706b 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/DefaultCheckpointProvider.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/DefaultCheckpointProvider.java @@ -26,8 +26,8 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformCheckpointingInfo; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformProgress; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import java.util.Arrays; import java.util.Collections; @@ -44,14 +44,14 @@ public class DefaultCheckpointProvider implements CheckpointProvider { /** * Builder for collecting checkpointing information for the purpose of _stats */ - private static class DataFrameTransformCheckpointingInfoBuilder { + private static class TransformCheckpointingInfoBuilder { private TransformIndexerPosition nextCheckpointPosition; private TransformProgress nextCheckpointProgress; private TransformCheckpoint lastCheckpoint; private TransformCheckpoint nextCheckpoint; private TransformCheckpoint sourceCheckpoint; - DataFrameTransformCheckpointingInfoBuilder() { + TransformCheckpointingInfoBuilder() { } TransformCheckpointingInfo build() { @@ -77,27 +77,27 @@ TransformCheckpointingInfo build() { TransformCheckpoint.getBehind(lastCheckpoint, sourceCheckpoint)); } - public DataFrameTransformCheckpointingInfoBuilder setLastCheckpoint(TransformCheckpoint lastCheckpoint) { + public TransformCheckpointingInfoBuilder setLastCheckpoint(TransformCheckpoint lastCheckpoint) { this.lastCheckpoint = lastCheckpoint; return this; } - public DataFrameTransformCheckpointingInfoBuilder setNextCheckpoint(TransformCheckpoint nextCheckpoint) { + public TransformCheckpointingInfoBuilder setNextCheckpoint(TransformCheckpoint nextCheckpoint) { this.nextCheckpoint = nextCheckpoint; return this; } - public DataFrameTransformCheckpointingInfoBuilder setSourceCheckpoint(TransformCheckpoint sourceCheckpoint) { + public TransformCheckpointingInfoBuilder setSourceCheckpoint(TransformCheckpoint sourceCheckpoint) { this.sourceCheckpoint = sourceCheckpoint; return this; } - public DataFrameTransformCheckpointingInfoBuilder setNextCheckpointProgress(TransformProgress nextCheckpointProgress) { + public TransformCheckpointingInfoBuilder setNextCheckpointProgress(TransformProgress nextCheckpointProgress) { this.nextCheckpointProgress = nextCheckpointProgress; return this; } - public DataFrameTransformCheckpointingInfoBuilder setNextCheckpointPosition(TransformIndexerPosition nextCheckpointPosition) { + public TransformCheckpointingInfoBuilder setNextCheckpointPosition(TransformIndexerPosition nextCheckpointPosition) { this.nextCheckpointPosition = nextCheckpointPosition; return this; } @@ -106,17 +106,17 @@ public DataFrameTransformCheckpointingInfoBuilder setNextCheckpointPosition(Tran private static final Logger logger = LogManager.getLogger(DefaultCheckpointProvider.class); protected final Client client; - protected final DataFrameTransformsConfigManager dataFrameTransformsConfigManager; - protected final DataFrameAuditor dataFrameAuditor; + protected final TransformConfigManager transformConfigManager; + protected final TransformAuditor transformAuditor; protected final TransformConfig transformConfig; public DefaultCheckpointProvider(final Client client, - final DataFrameTransformsConfigManager dataFrameTransformsConfigManager, - final DataFrameAuditor dataFrameAuditor, + final TransformConfigManager transformConfigManager, + final TransformAuditor transformAuditor, final TransformConfig transformConfig) { this.client = client; - this.dataFrameTransformsConfigManager = dataFrameTransformsConfigManager; - this.dataFrameAuditor = dataFrameAuditor; + this.transformConfigManager = transformConfigManager; + this.transformAuditor = transformAuditor; this.transformConfig = transformConfig; } @@ -146,14 +146,14 @@ protected void getIndexCheckpoints (ActionListener> listener .features(new GetIndexRequest.Feature[0]) .indicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN); - ClientHelper.executeWithHeadersAsync(transformConfig.getHeaders(), ClientHelper.DATA_FRAME_ORIGIN, client, GetIndexAction.INSTANCE, + ClientHelper.executeWithHeadersAsync(transformConfig.getHeaders(), ClientHelper.TRANSFORM_ORIGIN, client, GetIndexAction.INSTANCE, getIndexRequest, ActionListener.wrap(getIndexResponse -> { Set userIndices = getIndexResponse.getIndices() != null ? new HashSet<>(Arrays.asList(getIndexResponse.getIndices())) : Collections.emptySet(); // 2nd get stats request ClientHelper.executeAsyncWithOrigin(client, - ClientHelper.DATA_FRAME_ORIGIN, + ClientHelper.TRANSFORM_ORIGIN, IndicesStatsAction.INSTANCE, new IndicesStatsRequest() .indices(transformConfig.getSource().getIndex()) @@ -236,7 +236,7 @@ public void getCheckpointingInfo(TransformCheckpoint lastCheckpoint, TransformProgress nextCheckpointProgress, ActionListener listener) { - DataFrameTransformCheckpointingInfoBuilder checkpointingInfoBuilder = new DataFrameTransformCheckpointingInfoBuilder(); + TransformCheckpointingInfoBuilder checkpointingInfoBuilder = new TransformCheckpointingInfoBuilder(); checkpointingInfoBuilder.setLastCheckpoint(lastCheckpoint) .setNextCheckpoint(nextCheckpoint) @@ -257,7 +257,7 @@ public void getCheckpointingInfo(long lastCheckpointNumber, TransformIndexerPosi TransformProgress nextCheckpointProgress, ActionListener listener) { - DataFrameTransformCheckpointingInfoBuilder checkpointingInfoBuilder = new DataFrameTransformCheckpointingInfoBuilder(); + TransformCheckpointingInfoBuilder checkpointingInfoBuilder = new TransformCheckpointingInfoBuilder(); checkpointingInfoBuilder.setNextCheckpointPosition(nextCheckpointPosition).setNextCheckpointProgress(nextCheckpointProgress); @@ -272,7 +272,7 @@ public void getCheckpointingInfo(long lastCheckpointNumber, TransformIndexerPosi }, e -> { logger.debug((Supplier) () -> new ParameterizedMessage( - "Failed to retrieve source checkpoint for data frame [{}]", transformConfig.getId()), e); + "Failed to retrieve source checkpoint for transform [{}]", transformConfig.getId()), e); listener.onFailure(new CheckpointException("Failure during source checkpoint info retrieval", e)); } ); @@ -285,7 +285,7 @@ public void getCheckpointingInfo(long lastCheckpointNumber, TransformIndexerPosi }, e -> { logger.debug((Supplier) () -> new ParameterizedMessage( - "Failed to retrieve next checkpoint [{}] for data frame [{}]", lastCheckpointNumber + 1, + "Failed to retrieve next checkpoint [{}] for transform [{}]", lastCheckpointNumber + 1, transformConfig.getId()), e); listener.onFailure(new CheckpointException("Failure during next checkpoint info retrieval", e)); } @@ -295,19 +295,19 @@ public void getCheckpointingInfo(long lastCheckpointNumber, TransformIndexerPosi ActionListener lastCheckpointListener = ActionListener.wrap( lastCheckpointObj -> { checkpointingInfoBuilder.lastCheckpoint = lastCheckpointObj; - dataFrameTransformsConfigManager.getTransformCheckpoint(transformConfig.getId(), lastCheckpointNumber + 1, + transformConfigManager.getTransformCheckpoint(transformConfig.getId(), lastCheckpointNumber + 1, nextCheckpointListener); }, e -> { logger.debug((Supplier) () -> new ParameterizedMessage( - "Failed to retrieve last checkpoint [{}] for data frame [{}]", lastCheckpointNumber, + "Failed to retrieve last checkpoint [{}] for transform [{}]", lastCheckpointNumber, transformConfig.getId()), e); listener.onFailure(new CheckpointException("Failure during last checkpoint info retrieval", e)); } ); if (lastCheckpointNumber != 0) { - dataFrameTransformsConfigManager.getTransformCheckpoint(transformConfig.getId(), lastCheckpointNumber, lastCheckpointListener); + transformConfigManager.getTransformCheckpoint(transformConfig.getId(), lastCheckpointNumber, lastCheckpointListener); } else { getIndexCheckpoints(checkpointsByIndexListener); } @@ -324,7 +324,7 @@ void reportSourceIndexChanges(final Set lastSourceIndexes, final Set removedIndexes = Sets.difference(lastSourceIndexes, newSourceIndexes); Set addedIndexes = Sets.difference(newSourceIndexes, lastSourceIndexes); @@ -333,11 +333,11 @@ void reportSourceIndexChanges(final Set lastSourceIndexes, final Set 0) { String message = "Source index resolve found changes, removedIndexes: " + removedIndexes + ", new indexes: " + addedIndexes; logger.debug("{} for transform [{}]", message, transformConfig.getId()); - dataFrameAuditor.info(transformConfig.getId(), message); + transformAuditor.info(transformConfig.getId(), message); } } } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/TimeBasedCheckpointProvider.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/TimeBasedCheckpointProvider.java index f5f64ab714896..13d01d7ce31d4 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/TimeBasedCheckpointProvider.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/TimeBasedCheckpointProvider.java @@ -21,8 +21,8 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformCheckpoint; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TimeSyncConfig; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; public class TimeBasedCheckpointProvider extends DefaultCheckpointProvider { @@ -31,10 +31,10 @@ public class TimeBasedCheckpointProvider extends DefaultCheckpointProvider { private final TimeSyncConfig timeSyncConfig; TimeBasedCheckpointProvider(final Client client, - final DataFrameTransformsConfigManager dataFrameTransformsConfigManager, - final DataFrameAuditor dataFrameAuditor, + final TransformConfigManager transformConfigManager, + final TransformAuditor transformAuditor, final TransformConfig transformConfig) { - super(client, dataFrameTransformsConfigManager, dataFrameAuditor, transformConfig); + super(client, transformConfigManager, transformAuditor, transformConfig); timeSyncConfig = (TimeSyncConfig) transformConfig.getSyncConfig(); } @@ -64,7 +64,7 @@ public void sourceHasChanged(TransformCheckpoint lastCheckpoint, logger.trace("query for changes based on time: {}", sourceBuilder); - ClientHelper.executeWithHeadersAsync(transformConfig.getHeaders(), ClientHelper.DATA_FRAME_ORIGIN, client, SearchAction.INSTANCE, + ClientHelper.executeWithHeadersAsync(transformConfig.getHeaders(), ClientHelper.TRANSFORM_ORIGIN, client, SearchAction.INSTANCE, searchRequest, ActionListener.wrap(r -> { listener.onResponse(r.getHits().getTotalHits().value > 0L); }, listener::onFailure)); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/DataFrameTransformsCheckpointService.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/TransformCheckpointService.java similarity index 63% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/DataFrameTransformsCheckpointService.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/TransformCheckpointService.java index 9a0f15fa725d1..55464474aa585 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/DataFrameTransformsCheckpointService.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/checkpoint/TransformCheckpointService.java @@ -15,44 +15,44 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformProgress; import org.elasticsearch.xpack.core.transform.transforms.TimeSyncConfig; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; /** - * DataFrameTransform Checkpoint Service + * Transform Checkpoint Service * - * Allows checkpointing a source of a data frame transform which includes all relevant checkpoints of the source. + * Allows checkpointing a source of a transform which includes all relevant checkpoints of the source. * * This will be used to checkpoint a transform, detect changes, run the transform in continuous mode. * */ -public class DataFrameTransformsCheckpointService { +public class TransformCheckpointService { - private static final Logger logger = LogManager.getLogger(DataFrameTransformsCheckpointService.class); + private static final Logger logger = LogManager.getLogger(TransformCheckpointService.class); private final Client client; - private final DataFrameTransformsConfigManager dataFrameTransformsConfigManager; - private final DataFrameAuditor dataFrameAuditor; + private final TransformConfigManager transformConfigManager; + private final TransformAuditor transformAuditor; - public DataFrameTransformsCheckpointService(final Client client, - final DataFrameTransformsConfigManager dataFrameTransformsConfigManager, DataFrameAuditor dataFrameAuditor) { + public TransformCheckpointService(final Client client, + final TransformConfigManager transformConfigManager, TransformAuditor transformAuditor) { this.client = client; - this.dataFrameTransformsConfigManager = dataFrameTransformsConfigManager; - this.dataFrameAuditor = dataFrameAuditor; + this.transformConfigManager = transformConfigManager; + this.transformAuditor = transformAuditor; } public CheckpointProvider getCheckpointProvider(final TransformConfig transformConfig) { if (transformConfig.getSyncConfig() instanceof TimeSyncConfig) { - return new TimeBasedCheckpointProvider(client, dataFrameTransformsConfigManager, dataFrameAuditor, transformConfig); + return new TimeBasedCheckpointProvider(client, transformConfigManager, transformAuditor, transformConfig); } - return new DefaultCheckpointProvider(client, dataFrameTransformsConfigManager, dataFrameAuditor, transformConfig); + return new DefaultCheckpointProvider(client, transformConfigManager, transformAuditor, transformConfig); } /** - * Get checkpointing stats for a stopped data frame + * Get checkpointing stats for a stopped transform * - * @param transformId The data frame task + * @param transformId The transform id * @param lastCheckpointNumber the last checkpoint * @param nextCheckpointPosition position for the next checkpoint * @param nextCheckpointProgress progress for the next checkpoint @@ -65,13 +65,13 @@ public void getCheckpointingInfo(final String transformId, final ActionListener listener) { // we need to retrieve the config first before we can defer the rest to the corresponding provider - dataFrameTransformsConfigManager.getTransformConfiguration(transformId, ActionListener.wrap( + transformConfigManager.getTransformConfiguration(transformId, ActionListener.wrap( transformConfig -> { getCheckpointProvider(transformConfig).getCheckpointingInfo(lastCheckpointNumber, nextCheckpointPosition, nextCheckpointProgress, listener); }, transformError -> { - logger.warn("Failed to retrieve configuration for data frame [" + transformId + "]", transformError); + logger.warn("Failed to retrieve configuration for transform [" + transformId + "]", transformError); listener.onFailure(new CheckpointException("Failed to retrieve configuration", transformError)); }) ); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/notifications/DataFrameAuditor.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/notifications/TransformAuditor.java similarity index 55% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/notifications/DataFrameAuditor.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/notifications/TransformAuditor.java index 6aba693be10a8..055a3c02f8bb4 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/notifications/DataFrameAuditor.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/notifications/TransformAuditor.java @@ -8,16 +8,16 @@ import org.elasticsearch.client.Client; import org.elasticsearch.xpack.core.common.notifications.AbstractAuditor; import org.elasticsearch.xpack.core.transform.notifications.TransformAuditMessage; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; -import static org.elasticsearch.xpack.core.ClientHelper.DATA_FRAME_ORIGIN; +import static org.elasticsearch.xpack.core.ClientHelper.TRANSFORM_ORIGIN; /** - * DataFrameAuditor class that abstracts away generic templating for easier injection + * TransformAuditor class that abstracts away generic templating for easier injection */ -public class DataFrameAuditor extends AbstractAuditor { +public class TransformAuditor extends AbstractAuditor { - public DataFrameAuditor(Client client, String nodeName) { - super(client, nodeName, DataFrameInternalIndex.AUDIT_INDEX, DATA_FRAME_ORIGIN, TransformAuditMessage::new); + public TransformAuditor(Client client, String nodeName) { + super(client, nodeName, TransformInternalIndex.AUDIT_INDEX, TRANSFORM_ORIGIN, TransformAuditMessage::new); } } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/DataFrameTransformsConfigManager.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformConfigManager.java similarity index 87% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/DataFrameTransformsConfigManager.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformConfigManager.java index bc28ccd9d0d72..4bb4cbadd6a20 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/DataFrameTransformsConfigManager.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformConfigManager.java @@ -64,11 +64,11 @@ import java.util.Map; import java.util.Set; -import static org.elasticsearch.xpack.core.ClientHelper.DATA_FRAME_ORIGIN; +import static org.elasticsearch.xpack.core.ClientHelper.TRANSFORM_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; /** - * Place of all interactions with the internal transforms index. For configuration and mappings see @link{DataFrameInternalIndex} + * Place of all interactions with the internal transforms index. For configuration and mappings see @link{TransformInternalIndex} * * Versioned Index: * @@ -87,16 +87,16 @@ * * TODO: Provide a method that moves old docs into the current index and delete old indexes and templates */ -public class DataFrameTransformsConfigManager { +public class TransformConfigManager { - private static final Logger logger = LogManager.getLogger(DataFrameTransformsConfigManager.class); + private static final Logger logger = LogManager.getLogger(TransformConfigManager.class); public static final Map TO_XCONTENT_PARAMS = Collections.singletonMap(TransformField.FOR_INTERNAL_STORAGE, "true"); private final Client client; private final NamedXContentRegistry xContentRegistry; - public DataFrameTransformsConfigManager(Client client, NamedXContentRegistry xContentRegistry) { + public TransformConfigManager(Client client, NamedXContentRegistry xContentRegistry) { this.client = client; this.xContentRegistry = xContentRegistry; } @@ -104,20 +104,20 @@ public DataFrameTransformsConfigManager(Client client, NamedXContentRegistry xCo /** * Persist a checkpoint in the internal index * - * @param checkpoint the @link{DataFrameTransformCheckpoint} + * @param checkpoint the @link{TransformCheckpoint} * @param listener listener to call after request has been made */ public void putTransformCheckpoint(TransformCheckpoint checkpoint, ActionListener listener) { try (XContentBuilder builder = XContentFactory.jsonBuilder()) { XContentBuilder source = checkpoint.toXContent(builder, new ToXContent.MapParams(TO_XCONTENT_PARAMS)); - IndexRequest indexRequest = new IndexRequest(DataFrameInternalIndex.LATEST_INDEX_NAME) + IndexRequest indexRequest = new IndexRequest(TransformInternalIndex.LATEST_INDEX_NAME) .opType(DocWriteRequest.OpType.INDEX) .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE) .id(TransformCheckpoint.documentId(checkpoint.getTransformId(), checkpoint.getCheckpoint())) .source(source); - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, IndexAction.INSTANCE, indexRequest, ActionListener.wrap(r -> { + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, IndexAction.INSTANCE, indexRequest, ActionListener.wrap(r -> { listener.onResponse(true); }, listener::onFailure)); } catch (IOException e) { @@ -129,7 +129,7 @@ public void putTransformCheckpoint(TransformCheckpoint checkpoint, ActionListene /** * Store the transform configuration in the internal index * - * @param transformConfig the @link{DataFrameTransformConfig} + * @param transformConfig the @link{TransformConfig} * @param listener listener to call after request */ public void putTransformConfiguration(TransformConfig transformConfig, ActionListener listener) { @@ -139,10 +139,10 @@ public void putTransformConfiguration(TransformConfig transformConfig, ActionLis /** * Update the transform configuration in the internal index. * - * Essentially the same as {@link DataFrameTransformsConfigManager#putTransformConfiguration(TransformConfig, ActionListener)} + * Essentially the same as {@link TransformConfigManager#putTransformConfiguration(TransformConfig, ActionListener)} * but is an index operation that will fail with a version conflict * if the current document seqNo and primaryTerm is not the same as the provided version. - * @param transformConfig the @link{DataFrameTransformConfig} + * @param transformConfig the @link{TransformConfig} * @param seqNoPrimaryTermAndIndex an object containing the believed seqNo, primaryTerm and index for the doc. * Used for optimistic concurrency control * @param listener listener to call after request @@ -150,7 +150,7 @@ public void putTransformConfiguration(TransformConfig transformConfig, ActionLis public void updateTransformConfiguration(TransformConfig transformConfig, SeqNoPrimaryTermAndIndex seqNoPrimaryTermAndIndex, ActionListener listener) { - if (seqNoPrimaryTermAndIndex.getIndex().equals(DataFrameInternalIndex.LATEST_INDEX_NAME)) { + if (seqNoPrimaryTermAndIndex.getIndex().equals(TransformInternalIndex.LATEST_INDEX_NAME)) { // update the config in the same, current index using optimistic concurrency control putTransformConfiguration(transformConfig, DocWriteRequest.OpType.INDEX, seqNoPrimaryTermAndIndex, listener); } else { @@ -167,13 +167,13 @@ public void updateTransformConfiguration(TransformConfig transformConfig, * @param listener listener to alert on completion */ public void deleteOldTransformConfigurations(String transformId, ActionListener listener) { - DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(DataFrameInternalIndex.INDEX_NAME_PATTERN) + DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(TransformInternalIndex.INDEX_NAME_PATTERN) .setQuery(QueryBuilders.constantScoreQuery(QueryBuilders.boolQuery() - .mustNot(QueryBuilders.termQuery("_index", DataFrameInternalIndex.LATEST_INDEX_NAME)) + .mustNot(QueryBuilders.termQuery("_index", TransformInternalIndex.LATEST_INDEX_NAME)) .filter(QueryBuilders.termQuery("_id", TransformConfig.documentId(transformId))))) .setIndicesOptions(IndicesOptions.lenientExpandOpen()); - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, DeleteByQueryAction.INSTANCE, deleteByQueryRequest, ActionListener.wrap( + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, DeleteByQueryAction.INSTANCE, deleteByQueryRequest, ActionListener.wrap( response -> { if ((response.getBulkFailures().isEmpty() && response.getSearchFailures().isEmpty()) == false) { Tuple statusAndReason = getStatusAndReason(response); @@ -194,13 +194,13 @@ public void deleteOldTransformConfigurations(String transformId, ActionListener< * @param listener listener to alert on completion */ public void deleteOldTransformStoredDocuments(String transformId, ActionListener listener) { - DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(DataFrameInternalIndex.INDEX_NAME_PATTERN) + DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(TransformInternalIndex.INDEX_NAME_PATTERN) .setQuery(QueryBuilders.constantScoreQuery(QueryBuilders.boolQuery() - .mustNot(QueryBuilders.termQuery("_index", DataFrameInternalIndex.LATEST_INDEX_NAME)) + .mustNot(QueryBuilders.termQuery("_index", TransformInternalIndex.LATEST_INDEX_NAME)) .filter(QueryBuilders.termQuery("_id", TransformStoredDoc.documentId(transformId))))) .setIndicesOptions(IndicesOptions.lenientExpandOpen()); - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, DeleteByQueryAction.INSTANCE, deleteByQueryRequest, ActionListener.wrap( + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, DeleteByQueryAction.INSTANCE, deleteByQueryRequest, ActionListener.wrap( response -> { if ((response.getBulkFailures().isEmpty() && response.getSearchFailures().isEmpty()) == false) { Tuple statusAndReason = getStatusAndReason(response); @@ -221,7 +221,7 @@ private void putTransformConfiguration(TransformConfig transformConfig, try (XContentBuilder builder = XContentFactory.jsonBuilder()) { XContentBuilder source = transformConfig.toXContent(builder, new ToXContent.MapParams(TO_XCONTENT_PARAMS)); - IndexRequest indexRequest = new IndexRequest(DataFrameInternalIndex.LATEST_INDEX_NAME) + IndexRequest indexRequest = new IndexRequest(TransformInternalIndex.LATEST_INDEX_NAME) .opType(optType) .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE) .id(TransformConfig.documentId(transformConfig.getId())) @@ -230,23 +230,23 @@ private void putTransformConfiguration(TransformConfig transformConfig, indexRequest.setIfSeqNo(seqNoPrimaryTermAndIndex.getSeqNo()) .setIfPrimaryTerm(seqNoPrimaryTermAndIndex.getPrimaryTerm()); } - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, IndexAction.INSTANCE, indexRequest, ActionListener.wrap(r -> { + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, IndexAction.INSTANCE, indexRequest, ActionListener.wrap(r -> { listener.onResponse(true); }, e -> { if (e instanceof VersionConflictEngineException) { // the transform already exists listener.onFailure(new ResourceAlreadyExistsException( - TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_TRANSFORM_EXISTS, + TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_EXISTS, transformConfig.getId()))); } else { listener.onFailure( - new RuntimeException(TransformMessages.REST_PUT_DATA_FRAME_FAILED_PERSIST_TRANSFORM_CONFIGURATION, e)); + new RuntimeException(TransformMessages.REST_PUT_FAILED_PERSIST_TRANSFORM_CONFIGURATION, e)); } })); } catch (IOException e) { // not expected to happen but for the sake of completeness listener.onFailure(new ElasticsearchParseException( - TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_FAILED_TO_SERIALIZE_TRANSFORM, transformConfig.getId()), + TransformMessages.getMessage(TransformMessages.REST_FAILED_TO_SERIALIZE_TRANSFORM, transformConfig.getId()), e)); } } @@ -260,14 +260,14 @@ private void putTransformConfiguration(TransformConfig transformConfig, */ public void getTransformCheckpoint(String transformId, long checkpoint, ActionListener resultListener) { QueryBuilder queryBuilder = QueryBuilders.termQuery("_id", TransformCheckpoint.documentId(transformId, checkpoint)); - SearchRequest searchRequest = client.prepareSearch(DataFrameInternalIndex.INDEX_NAME_PATTERN) + SearchRequest searchRequest = client.prepareSearch(TransformInternalIndex.INDEX_NAME_PATTERN) .setQuery(queryBuilder) // use sort to get the last .addSort("_index", SortOrder.DESC) .setSize(1) .request(); - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, SearchAction.INSTANCE, searchRequest, ActionListener.wrap( + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, SearchAction.INSTANCE, searchRequest, ActionListener.wrap( searchResponse -> { if (searchResponse.getHits().getHits().length == 0) { // do not fail if checkpoint does not exist but return an empty checkpoint @@ -282,26 +282,26 @@ public void getTransformCheckpoint(String transformId, long checkpoint, ActionLi /** * Get the transform configuration for a given transform id. This function is only for internal use. For transforms returned via GET - * data_frame/transforms, see the TransportGetDataFrameTransformsAction + * data_frame/transforms, see the @link{TransportGetTransformAction} * * @param transformId the transform id * @param resultListener listener to call after inner request has returned */ public void getTransformConfiguration(String transformId, ActionListener resultListener) { QueryBuilder queryBuilder = QueryBuilders.termQuery("_id", TransformConfig.documentId(transformId)); - SearchRequest searchRequest = client.prepareSearch(DataFrameInternalIndex.INDEX_NAME_PATTERN) + SearchRequest searchRequest = client.prepareSearch(TransformInternalIndex.INDEX_NAME_PATTERN) .setQuery(queryBuilder) // use sort to get the last .addSort("_index", SortOrder.DESC) .setSize(1) .request(); - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, SearchAction.INSTANCE, searchRequest, + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, SearchAction.INSTANCE, searchRequest, ActionListener.wrap( searchResponse -> { if (searchResponse.getHits().getHits().length == 0) { resultListener.onFailure(new ResourceNotFoundException( - TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, transformId))); + TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, transformId))); return; } BytesReference source = searchResponse.getHits().getHits()[0].getSourceRef(); @@ -311,7 +311,7 @@ public void getTransformConfiguration(String transformId, ActionListener> configAndVersionListener) { QueryBuilder queryBuilder = QueryBuilders.termQuery("_id", TransformConfig.documentId(transformId)); - SearchRequest searchRequest = client.prepareSearch(DataFrameInternalIndex.INDEX_NAME_PATTERN) + SearchRequest searchRequest = client.prepareSearch(TransformInternalIndex.INDEX_NAME_PATTERN) .setQuery(queryBuilder) // use sort to get the last .addSort("_index", SortOrder.DESC) @@ -328,11 +328,11 @@ public void getTransformConfigurationForUpdate(String transformId, .seqNoAndPrimaryTerm(true) .request(); - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, SearchAction.INSTANCE, searchRequest, ActionListener.wrap( + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, SearchAction.INSTANCE, searchRequest, ActionListener.wrap( searchResponse -> { if (searchResponse.getHits().getHits().length == 0) { configAndVersionListener.onFailure(new ResourceNotFoundException( - TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, transformId))); + TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, transformId))); return; } SearchHit hit = searchResponse.getHits().getHits()[0]; @@ -361,7 +361,7 @@ public void expandTransformIds(String transformIdsExpression, String[] idTokens = ExpandedIdsMatcher.tokenizeExpression(transformIdsExpression); QueryBuilder queryBuilder = buildQueryFromTokenizedIds(idTokens, TransformConfig.NAME); - SearchRequest request = client.prepareSearch(DataFrameInternalIndex.INDEX_NAME_PATTERN) + SearchRequest request = client.prepareSearch(TransformInternalIndex.INDEX_NAME_PATTERN) .addSort(TransformField.ID.getPreferredName(), SortOrder.ASC) .setFrom(pageParams.getFrom()) .setTrackTotalHits(true) @@ -373,7 +373,7 @@ public void expandTransformIds(String transformIdsExpression, final ExpandedIdsMatcher requiredMatches = new ExpandedIdsMatcher(idTokens, allowNoMatch); - executeAsyncWithOrigin(client.threadPool().getThreadContext(), DATA_FRAME_ORIGIN, request, ActionListener.wrap( + executeAsyncWithOrigin(client.threadPool().getThreadContext(), TRANSFORM_ORIGIN, request, ActionListener.wrap( searchResponse -> { long totalHits = searchResponse.getHits().getTotalHits().value; // important: preserve order @@ -394,7 +394,7 @@ public void expandTransformIds(String transformIdsExpression, // some required Ids were not found foundIdsListener.onFailure( new ResourceNotFoundException( - TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, + TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, requiredMatches.unmatchedIdsString()))); return; } @@ -412,22 +412,22 @@ public void deleteTransform(String transformId, ActionListener listener DeleteByQueryRequest request = new DeleteByQueryRequest() .setAbortOnVersionConflict(false); //since these documents are not updated, a conflict just means it was deleted previously - request.indices(DataFrameInternalIndex.INDEX_NAME_PATTERN); + request.indices(TransformInternalIndex.INDEX_NAME_PATTERN); QueryBuilder query = QueryBuilders.termQuery(TransformField.ID.getPreferredName(), transformId); request.setQuery(query); request.setRefresh(true); - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, DeleteByQueryAction.INSTANCE, request, ActionListener.wrap(deleteResponse -> { + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, DeleteByQueryAction.INSTANCE, request, ActionListener.wrap(deleteResponse -> { if (deleteResponse.getDeleted() == 0) { listener.onFailure(new ResourceNotFoundException( - TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, transformId))); + TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, transformId))); return; } listener.onResponse(true); }, e -> { if (e.getClass() == IndexNotFoundException.class) { listener.onFailure(new ResourceNotFoundException( - TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, transformId))); + TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, transformId))); } else { listener.onFailure(e); } @@ -440,12 +440,12 @@ public void putOrUpdateTransformStoredDoc(TransformStoredDoc stats, try (XContentBuilder builder = XContentFactory.jsonBuilder()) { XContentBuilder source = stats.toXContent(builder, new ToXContent.MapParams(TO_XCONTENT_PARAMS)); - IndexRequest indexRequest = new IndexRequest(DataFrameInternalIndex.LATEST_INDEX_NAME) + IndexRequest indexRequest = new IndexRequest(TransformInternalIndex.LATEST_INDEX_NAME) .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE) .id(TransformStoredDoc.documentId(stats.getId())) .source(source); if (seqNoPrimaryTermAndIndex != null && - seqNoPrimaryTermAndIndex.getIndex().equals(DataFrameInternalIndex.LATEST_INDEX_NAME)) { + seqNoPrimaryTermAndIndex.getIndex().equals(TransformInternalIndex.LATEST_INDEX_NAME)) { indexRequest.opType(DocWriteRequest.OpType.INDEX) .setIfSeqNo(seqNoPrimaryTermAndIndex.getSeqNo()) .setIfPrimaryTerm(seqNoPrimaryTermAndIndex.getPrimaryTerm()); @@ -454,16 +454,16 @@ public void putOrUpdateTransformStoredDoc(TransformStoredDoc stats, // so, it should be a create option without the seqNo and primaryTerm set indexRequest.opType(DocWriteRequest.OpType.CREATE); } - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, IndexAction.INSTANCE, indexRequest, ActionListener.wrap( + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, IndexAction.INSTANCE, indexRequest, ActionListener.wrap( r -> listener.onResponse(SeqNoPrimaryTermAndIndex.fromIndexResponse(r)), e -> listener.onFailure(new RuntimeException( - TransformMessages.getMessage(TransformMessages.DATA_FRAME_FAILED_TO_PERSIST_STATS, stats.getId()), + TransformMessages.getMessage(TransformMessages.TRANSFORM_FAILED_TO_PERSIST_STATS, stats.getId()), e)) )); } catch (IOException e) { // not expected to happen but for the sake of completeness listener.onFailure(new ElasticsearchParseException( - TransformMessages.getMessage(TransformMessages.DATA_FRAME_FAILED_TO_PERSIST_STATS, stats.getId()), + TransformMessages.getMessage(TransformMessages.TRANSFORM_FAILED_TO_PERSIST_STATS, stats.getId()), e)); } } @@ -471,7 +471,7 @@ public void putOrUpdateTransformStoredDoc(TransformStoredDoc stats, public void getTransformStoredDoc(String transformId, ActionListener> resultListener) { QueryBuilder queryBuilder = QueryBuilders.termQuery("_id", TransformStoredDoc.documentId(transformId)); - SearchRequest searchRequest = client.prepareSearch(DataFrameInternalIndex.INDEX_NAME_PATTERN) + SearchRequest searchRequest = client.prepareSearch(TransformInternalIndex.INDEX_NAME_PATTERN) .setQuery(queryBuilder) // use sort to get the last .addSort("_index", SortOrder.DESC) @@ -479,11 +479,11 @@ public void getTransformStoredDoc(String transformId, .seqNoAndPrimaryTerm(true) .request(); - executeAsyncWithOrigin(client, DATA_FRAME_ORIGIN, SearchAction.INSTANCE, searchRequest, ActionListener.wrap( + executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, SearchAction.INSTANCE, searchRequest, ActionListener.wrap( searchResponse -> { if (searchResponse.getHits().getHits().length == 0) { resultListener.onFailure(new ResourceNotFoundException( - TransformMessages.getMessage(TransformMessages.DATA_FRAME_UNKNOWN_TRANSFORM_STATS, transformId))); + TransformMessages.getMessage(TransformMessages.UNKNOWN_TRANSFORM_STATS, transformId))); return; } SearchHit searchHit = searchResponse.getHits().getHits()[0]; @@ -507,7 +507,7 @@ public void getTransformStoredDoc(Collection transformIds, ActionListene .filter(QueryBuilders.termsQuery(TransformField.ID.getPreferredName(), transformIds)) .filter(QueryBuilders.termQuery(TransformField.INDEX_DOC_TYPE.getPreferredName(), TransformStoredDoc.NAME))); - SearchRequest searchRequest = client.prepareSearch(DataFrameInternalIndex.INDEX_NAME_PATTERN) + SearchRequest searchRequest = client.prepareSearch(TransformInternalIndex.INDEX_NAME_PATTERN) .addSort(TransformField.ID.getPreferredName(), SortOrder.ASC) .addSort("_index", SortOrder.DESC) .setQuery(builder) @@ -515,7 +515,7 @@ public void getTransformStoredDoc(Collection transformIds, ActionListene .setSize(Math.min(transformIds.size(), 10_000)) .request(); - executeAsyncWithOrigin(client.threadPool().getThreadContext(), DATA_FRAME_ORIGIN, searchRequest, + executeAsyncWithOrigin(client.threadPool().getThreadContext(), TRANSFORM_ORIGIN, searchRequest, ActionListener.wrap( searchResponse -> { List stats = new ArrayList<>(); @@ -531,7 +531,7 @@ public void getTransformStoredDoc(Collection transformIds, ActionListene stats.add(TransformStoredDoc.fromXContent(parser)); } catch (IOException e) { listener.onFailure( - new ElasticsearchParseException("failed to parse data frame stats from search hit", e)); + new ElasticsearchParseException("failed to parse transform stats from search hit", e)); return; } } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/DataframeIndex.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformIndex.java similarity index 95% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/DataframeIndex.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformIndex.java index f87ba548867a9..d1d2e24f28e7c 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/DataframeIndex.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformIndex.java @@ -28,14 +28,14 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.mapper.MapperService.SINGLE_MAPPING_NAME; -public final class DataframeIndex { - private static final Logger logger = LogManager.getLogger(DataframeIndex.class); +public final class TransformIndex { + private static final Logger logger = LogManager.getLogger(TransformIndex.class); private static final String PROPERTIES = "properties"; private static final String TYPE = "type"; private static final String META = "_meta"; - private DataframeIndex() { + private TransformIndex() { } public static void createDestinationIndex(Client client, @@ -97,7 +97,7 @@ private static XContentBuilder addProperties(XContentBuilder builder, private static XContentBuilder addMetaData(XContentBuilder builder, String id, Clock clock) throws IOException { return builder.startObject(META) - .field(TransformField.CREATED_BY, TransformField.DATA_FRAME_SIGNATURE) + .field(TransformField.CREATED_BY, TransformField.TRANSFORM_SIGNATURE) .startObject(TransformField.META_FIELDNAME) .field(TransformField.CREATION_DATE_MILLIS, clock.millis()) .startObject(TransformField.VERSION.getPreferredName()) diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/DataFrameInternalIndex.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndex.java similarity index 95% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/DataFrameInternalIndex.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndex.java index 4834df6158441..3d614b3da5ff5 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/DataFrameInternalIndex.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndex.java @@ -37,11 +37,11 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.mapper.MapperService.SINGLE_MAPPING_NAME; -import static org.elasticsearch.xpack.core.ClientHelper.DATA_FRAME_ORIGIN; +import static org.elasticsearch.xpack.core.ClientHelper.TRANSFORM_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; import static org.elasticsearch.xpack.core.transform.TransformField.TRANSFORM_ID; -public final class DataFrameInternalIndex { +public final class TransformInternalIndex { /* Changelog of internal index versions * @@ -82,7 +82,7 @@ public final class DataFrameInternalIndex { public static final String KEYWORD = "keyword"; public static IndexTemplateMetaData getIndexTemplateMetaData() throws IOException { - IndexTemplateMetaData dataFrameTemplate = IndexTemplateMetaData.builder(LATEST_INDEX_VERSIONED_NAME) + IndexTemplateMetaData transformTemplate = IndexTemplateMetaData.builder(LATEST_INDEX_VERSIONED_NAME) .patterns(Collections.singletonList(LATEST_INDEX_VERSIONED_NAME)) .version(Version.CURRENT.id) .settings(Settings.builder() @@ -91,11 +91,11 @@ public static IndexTemplateMetaData getIndexTemplateMetaData() throws IOExceptio .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-1")) .putMapping(MapperService.SINGLE_MAPPING_NAME, Strings.toString(mappings())) .build(); - return dataFrameTemplate; + return transformTemplate; } public static IndexTemplateMetaData getAuditIndexTemplateMetaData() throws IOException { - IndexTemplateMetaData dataFrameTemplate = IndexTemplateMetaData.builder(AUDIT_INDEX) + IndexTemplateMetaData transformTemplate = IndexTemplateMetaData.builder(AUDIT_INDEX) .patterns(Collections.singletonList(AUDIT_INDEX_PREFIX + "*")) .version(Version.CURRENT.id) .settings(Settings.builder() @@ -104,7 +104,7 @@ public static IndexTemplateMetaData getAuditIndexTemplateMetaData() throws IOExc .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-1")) .putMapping(MapperService.SINGLE_MAPPING_NAME, Strings.toString(auditMappings())) .build(); - return dataFrameTemplate; + return transformTemplate; } private static XContentBuilder auditMappings() throws IOException { @@ -158,11 +158,11 @@ public static XContentBuilder mappings(XContentBuilder builder) throws IOExcepti // overall doc type builder.startObject(TransformField.INDEX_DOC_TYPE.getPreferredName()).field(TYPE, KEYWORD).endObject(); // add the schema for transform configurations - addDataFrameTransformsConfigMappings(builder); + addTransformsConfigMappings(builder); // add the schema for transform stats - addDataFrameTransformStoredDocMappings(builder); + addTransformStoredDocMappings(builder); // add the schema for checkpoints - addDataFrameCheckpointMappings(builder); + addTransformCheckpointMappings(builder); // end type builder.endObject(); // end properties @@ -173,7 +173,7 @@ public static XContentBuilder mappings(XContentBuilder builder) throws IOExcepti } - private static XContentBuilder addDataFrameTransformStoredDocMappings(XContentBuilder builder) throws IOException { + private static XContentBuilder addTransformStoredDocMappings(XContentBuilder builder) throws IOException { return builder .startObject(TransformStoredDoc.STATE_FIELD.getPreferredName()) .startObject(PROPERTIES) @@ -261,7 +261,7 @@ private static XContentBuilder addDataFrameTransformStoredDocMappings(XContentBu // .startObject("checkpointing").field(ENABLED, false).endObject(); } - public static XContentBuilder addDataFrameTransformsConfigMappings(XContentBuilder builder) throws IOException { + public static XContentBuilder addTransformsConfigMappings(XContentBuilder builder) throws IOException { return builder .startObject(TransformField.ID.getPreferredName()) .field(TYPE, KEYWORD) @@ -294,7 +294,7 @@ public static XContentBuilder addDataFrameTransformsConfigMappings(XContentBuild .endObject(); } - private static XContentBuilder addDataFrameCheckpointMappings(XContentBuilder builder) throws IOException { + private static XContentBuilder addTransformCheckpointMappings(XContentBuilder builder) throws IOException { return builder .startObject(TransformField.TIMESTAMP_MILLIS.getPreferredName()) .field(TYPE, DATE) @@ -350,13 +350,13 @@ public static void installLatestVersionedIndexTemplateIfRequired(ClusterService .settings(indexTemplateMetaData.settings()) .mapping(SINGLE_MAPPING_NAME, XContentHelper.convertToMap(jsonMappings, true, XContentType.JSON).v2()); ActionListener innerListener = ActionListener.wrap(r -> listener.onResponse(null), listener::onFailure); - executeAsyncWithOrigin(client.threadPool().getThreadContext(), DATA_FRAME_ORIGIN, request, + executeAsyncWithOrigin(client.threadPool().getThreadContext(), TRANSFORM_ORIGIN, request, innerListener, client.admin().indices()::putTemplate); } catch (IOException e) { listener.onFailure(e); } } - private DataFrameInternalIndex() { + private TransformInternalIndex() { } } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java similarity index 84% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java index c1e74405dc88e..a240801420a57 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformAction.java @@ -14,16 +14,16 @@ import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.DeleteTransformAction; -public class RestDeleteDataFrameTransformAction extends BaseRestHandler { +public class RestDeleteTransformAction extends BaseRestHandler { - public RestDeleteDataFrameTransformAction(RestController controller) { + public RestDeleteTransformAction(RestController controller) { controller.registerHandler(RestRequest.Method.DELETE, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, this); } @Override protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) { if (restRequest.hasContent()) { - throw new IllegalArgumentException("delete data frame transforms requests can not have a request body"); + throw new IllegalArgumentException("delete transform requests can not have a request body"); } String id = restRequest.param(TransformField.ID.getPreferredName()); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetDataFrameTransformsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java similarity index 93% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetDataFrameTransformsAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java index e99165267ea8f..d5ddef41d0c63 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetDataFrameTransformsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformAction.java @@ -17,9 +17,9 @@ import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; -public class RestGetDataFrameTransformsAction extends BaseRestHandler { +public class RestGetTransformAction extends BaseRestHandler { - public RestGetDataFrameTransformsAction(RestController controller) { + public RestGetTransformAction(RestController controller) { controller.registerHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS, this); controller.registerHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, this); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetDataFrameTransformsStatsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java similarity index 93% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetDataFrameTransformsStatsAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java index 4e89bc6370b46..7fc8d2ba65667 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetDataFrameTransformsStatsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestGetTransformStatsAction.java @@ -17,9 +17,9 @@ import static org.elasticsearch.xpack.core.transform.TransformField.ALLOW_NO_MATCH; -public class RestGetDataFrameTransformsStatsAction extends BaseRestHandler { +public class RestGetTransformStatsAction extends BaseRestHandler { - public RestGetDataFrameTransformsStatsAction(RestController controller) { + public RestGetTransformStatsAction(RestController controller) { controller.registerHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS + "_stats", this); controller.registerHandler(RestRequest.Method.GET, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stats", this); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java similarity index 90% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java index 6a051712180ea..3bba1574a453f 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPreviewTransformAction.java @@ -17,9 +17,9 @@ import java.io.IOException; -public class RestPreviewDataFrameTransformAction extends BaseRestHandler { +public class RestPreviewTransformAction extends BaseRestHandler { - public RestPreviewDataFrameTransformAction(RestController controller) { + public RestPreviewTransformAction(RestController controller) { controller.registerHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH + "transforms/_preview", this); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java similarity index 91% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java index 97f2804865461..3b87c13f5d255 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestPutTransformAction.java @@ -17,9 +17,9 @@ import java.io.IOException; -public class RestPutDataFrameTransformAction extends BaseRestHandler { +public class RestPutTransformAction extends BaseRestHandler { - public RestPutDataFrameTransformAction(RestController controller) { + public RestPutTransformAction(RestController controller) { controller.registerHandler(RestRequest.Method.PUT, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID, this); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java similarity index 91% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java index 3150cba53a4f6..d016f58bb798c 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStartTransformAction.java @@ -15,9 +15,9 @@ import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.StartTransformAction; -public class RestStartDataFrameTransformAction extends BaseRestHandler { +public class RestStartTransformAction extends BaseRestHandler { - public RestStartDataFrameTransformAction(RestController controller) { + public RestStartTransformAction(RestController controller) { controller.registerHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_start", this); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java similarity index 93% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java index 40e6a6eee136a..49ba802e5b6fe 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestStopTransformAction.java @@ -14,9 +14,9 @@ import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.action.StopTransformAction; -public class RestStopDataFrameTransformAction extends BaseRestHandler { +public class RestStopTransformAction extends BaseRestHandler { - public RestStopDataFrameTransformAction(RestController controller) { + public RestStopTransformAction(RestController controller) { controller.registerHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_stop", this); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateDataFrameTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java similarity index 91% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateDataFrameTransformAction.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java index 6a521faa598b8..1e67b8b912e60 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateDataFrameTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/rest/action/RestUpdateTransformAction.java @@ -17,9 +17,9 @@ import java.io.IOException; -public class RestUpdateDataFrameTransformAction extends BaseRestHandler { +public class RestUpdateTransformAction extends BaseRestHandler { - public RestUpdateDataFrameTransformAction(RestController controller) { + public RestUpdateTransformAction(RestController controller) { controller.registerHandler(RestRequest.Method.POST, TransformField.REST_BASE_PATH_TRANSFORMS_BY_ID + "_update", this); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientDataFrameIndexer.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientTransformIndexer.java similarity index 92% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientDataFrameIndexer.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientTransformIndexer.java index a32b5ff6abc57..76f654678baa9 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientDataFrameIndexer.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientTransformIndexer.java @@ -36,8 +36,8 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformTaskState; import org.elasticsearch.xpack.core.transform.utils.ExceptionsHelper; import org.elasticsearch.xpack.transform.checkpoint.CheckpointProvider; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import org.elasticsearch.xpack.transform.persistence.SeqNoPrimaryTermAndIndex; import org.elasticsearch.xpack.transform.transforms.pivot.AggregationResultUtils; @@ -47,16 +47,16 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -class ClientDataFrameIndexer extends DataFrameIndexer { +class ClientTransformIndexer extends TransformIndexer { - private static final Logger logger = LogManager.getLogger(ClientDataFrameIndexer.class); + private static final Logger logger = LogManager.getLogger(ClientTransformIndexer.class); private long logEvery = 1; private long logCount = 0; private final Client client; - private final DataFrameTransformsConfigManager transformsConfigManager; + private final TransformConfigManager transformsConfigManager; private final CheckpointProvider checkpointProvider; - private final DataFrameTransformTask transformTask; + private final TransformTask transformTask; private final AtomicInteger failureCount; private volatile boolean auditBulkFailures = true; // Indicates that the source has changed for the current run @@ -66,19 +66,19 @@ class ClientDataFrameIndexer extends DataFrameIndexer { private final AtomicBoolean oldStatsCleanedUp = new AtomicBoolean(false); private volatile Instant changesLastDetectedAt; - ClientDataFrameIndexer(DataFrameTransformsConfigManager transformsConfigManager, + ClientTransformIndexer(TransformConfigManager transformsConfigManager, CheckpointProvider checkpointProvider, AtomicReference initialState, TransformIndexerPosition initialPosition, Client client, - DataFrameAuditor auditor, + TransformAuditor auditor, TransformIndexerStats initialStats, TransformConfig transformConfig, Map fieldMappings, TransformProgress transformProgress, TransformCheckpoint lastCheckpoint, TransformCheckpoint nextCheckpoint, - DataFrameTransformTask parentTask) { + TransformTask parentTask) { super(ExceptionsHelper.requireNonNull(parentTask, "parentTask") .getThreadPool() .executor(ThreadPool.Names.GENERIC), @@ -150,7 +150,7 @@ protected void onStart(long now, ActionListener listener) { transformsConfigManager.getTransformConfiguration(getJobId(), ActionListener.wrap( config -> { transformConfig = config; - logger.debug("[{}] successfully refreshed data frame transform config from index.", getJobId()); + logger.debug("[{}] successfully refreshed transform config from index.", getJobId()); updateConfigListener.onResponse(null); }, failure -> { @@ -237,7 +237,7 @@ protected void doNextSearch(SearchRequest request, ActionListener next return; } ClientHelper.executeWithHeadersAsync(transformConfig.getHeaders(), - ClientHelper.DATA_FRAME_ORIGIN, + ClientHelper.TRANSFORM_ORIGIN, client, BulkAction.INSTANCE, request, @@ -298,7 +298,7 @@ protected void doSaveState(IndexerState indexerState, TransformIndexerPosition p } // This means that the indexer was triggered to discover changes, found none, and exited early. - // If the state is `STOPPED` this means that DataFrameTransformTask#stop was called while we were checking for changes. + // If the state is `STOPPED` this means that TransformTask#stop was called while we were checking for changes. // Allow the stop call path to continue if (hasSourceChanged == false && indexerState.equals(IndexerState.STOPPED) == false) { next.run(); @@ -313,8 +313,8 @@ protected void doSaveState(IndexerState indexerState, TransformIndexerPosition p // set both to stopped so they are persisted as such indexerState = IndexerState.STOPPED; - auditor.info(transformConfig.getId(), "Data frame finished indexing all data, initiating stop"); - logger.info("[{}] data frame transform finished indexing all data, initiating stop.", transformConfig.getId()); + auditor.info(transformConfig.getId(), "Transform finished indexing all data, initiating stop"); + logger.info("[{}] transform finished indexing all data, initiating stop.", transformConfig.getId()); } // If we are `STOPPED` on a `doSaveState` call, that indicates we transitioned to `STOPPED` from `STOPPING` @@ -393,7 +393,7 @@ protected void onFailure(Exception exc) { handleFailure(exc); } catch (Exception e) { logger.error( - new ParameterizedMessage("[{}] data frame transform encountered an unexpected internal exception: ", getJobId()), + new ParameterizedMessage("[{}] transform encountered an unexpected internal exception: ", getJobId()), e); } } @@ -442,10 +442,10 @@ protected void onFinish(ActionListener listener) { } if (shouldAuditOnFinish(checkpoint)) { auditor.info(getJobId(), - "Finished indexing for data frame transform checkpoint [" + checkpoint + "]."); + "Finished indexing for transform checkpoint [" + checkpoint + "]."); } logger.debug( - "[{}] finished indexing for data frame transform checkpoint [{}].", getJobId(), checkpoint); + "[{}] finished indexing for transform checkpoint [{}].", getJobId(), checkpoint); auditBulkFailures = true; listener.onResponse(null); } catch (Exception e) { @@ -478,14 +478,14 @@ protected boolean shouldAuditOnFinish(long completedCheckpoint) { @Override protected void onStop() { - auditor.info(transformConfig.getId(), "Data frame transform has stopped."); - logger.info("[{}] data frame transform has stopped.", transformConfig.getId()); + auditor.info(transformConfig.getId(), "Transform has stopped."); + logger.info("[{}] transform has stopped.", transformConfig.getId()); } @Override protected void onAbort() { - auditor.info(transformConfig.getId(), "Received abort request, stopping data frame transform."); - logger.info("[{}] data frame transform received abort request. Stopping indexer.", transformConfig.getId()); + auditor.info(transformConfig.getId(), "Received abort request, stopping transform."); + logger.info("[{}] transform received abort request. Stopping indexer.", transformConfig.getId()); transformTask.shutdown(); } @@ -524,11 +524,11 @@ protected void sourceHasChanged(ActionListener hasChangedListener) { e -> { logger.warn( new ParameterizedMessage( - "[{}] failed to detect changes for data frame transform. Skipping update till next check.", + "[{}] failed to detect changes for transform. Skipping update till next check.", getJobId()), e); auditor.warning(getJobId(), - "Failed to detect changes for data frame transform, skipping update till next check. Exception: " + "Failed to detect changes for transform, skipping update till next check. Exception: " + e.getMessage()); hasChangedListener.onResponse(false); })); @@ -541,7 +541,7 @@ private boolean isIrrecoverableFailure(Exception e) { } synchronized void handleFailure(Exception e) { - logger.warn(new ParameterizedMessage("[{}] data frame transform encountered an exception: ", + logger.warn(new ParameterizedMessage("[{}] transform encountered an exception: ", getJobId()), e); if (handleCircuitBreakingException(e)) { @@ -558,7 +558,7 @@ synchronized void handleFailure(Exception e) { // times in a row, very quickly. We do not want to spam the audit log with repeated failures, so only record the first one if (e.getMessage().equals(lastAuditedExceptionMessage) == false) { auditor.warning(getJobId(), - "Data frame transform encountered an exception: " + e.getMessage() + + "Transform encountered an exception: " + e.getMessage() + " Will attempt again at next scheduled trigger."); lastAuditedExceptionMessage = e.getMessage(); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientDataFrameIndexerBuilder.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientTransformIndexerBuilder.java similarity index 67% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientDataFrameIndexerBuilder.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientTransformIndexerBuilder.java index f2557cc859061..f60bada209f34 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientDataFrameIndexerBuilder.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/ClientTransformIndexerBuilder.java @@ -14,18 +14,18 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformProgress; import org.elasticsearch.xpack.transform.checkpoint.CheckpointProvider; -import org.elasticsearch.xpack.transform.checkpoint.DataFrameTransformsCheckpointService; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.checkpoint.TransformCheckpointService; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; -class ClientDataFrameIndexerBuilder { +class ClientTransformIndexerBuilder { private Client client; - private DataFrameTransformsConfigManager transformsConfigManager; - private DataFrameTransformsCheckpointService transformsCheckpointService; - private DataFrameAuditor auditor; + private TransformConfigManager transformsConfigManager; + private TransformCheckpointService transformsCheckpointService; + private TransformAuditor auditor; private Map fieldMappings; private TransformConfig transformConfig; private TransformIndexerStats initialStats; @@ -35,14 +35,14 @@ class ClientDataFrameIndexerBuilder { private TransformCheckpoint lastCheckpoint; private TransformCheckpoint nextCheckpoint; - ClientDataFrameIndexerBuilder() { + ClientTransformIndexerBuilder() { this.initialStats = new TransformIndexerStats(); } - ClientDataFrameIndexer build(DataFrameTransformTask parentTask) { + ClientTransformIndexer build(TransformTask parentTask) { CheckpointProvider checkpointProvider = transformsCheckpointService.getCheckpointProvider(transformConfig); - return new ClientDataFrameIndexer(this.transformsConfigManager, + return new ClientTransformIndexer(this.transformsConfigManager, checkpointProvider, new AtomicReference<>(this.indexerState), this.initialPosition, @@ -57,32 +57,32 @@ ClientDataFrameIndexer build(DataFrameTransformTask parentTask) { parentTask); } - ClientDataFrameIndexerBuilder setClient(Client client) { + ClientTransformIndexerBuilder setClient(Client client) { this.client = client; return this; } - ClientDataFrameIndexerBuilder setTransformsConfigManager(DataFrameTransformsConfigManager transformsConfigManager) { + ClientTransformIndexerBuilder setTransformsConfigManager(TransformConfigManager transformsConfigManager) { this.transformsConfigManager = transformsConfigManager; return this; } - ClientDataFrameIndexerBuilder setTransformsCheckpointService(DataFrameTransformsCheckpointService transformsCheckpointService) { + ClientTransformIndexerBuilder setTransformsCheckpointService(TransformCheckpointService transformsCheckpointService) { this.transformsCheckpointService = transformsCheckpointService; return this; } - ClientDataFrameIndexerBuilder setAuditor(DataFrameAuditor auditor) { + ClientTransformIndexerBuilder setAuditor(TransformAuditor auditor) { this.auditor = auditor; return this; } - ClientDataFrameIndexerBuilder setFieldMappings(Map fieldMappings) { + ClientTransformIndexerBuilder setFieldMappings(Map fieldMappings) { this.fieldMappings = fieldMappings; return this; } - ClientDataFrameIndexerBuilder setTransformConfig(TransformConfig transformConfig) { + ClientTransformIndexerBuilder setTransformConfig(TransformConfig transformConfig) { this.transformConfig = transformConfig; return this; } @@ -91,32 +91,32 @@ TransformConfig getTransformConfig() { return this.transformConfig; } - ClientDataFrameIndexerBuilder setInitialStats(TransformIndexerStats initialStats) { + ClientTransformIndexerBuilder setInitialStats(TransformIndexerStats initialStats) { this.initialStats = initialStats; return this; } - ClientDataFrameIndexerBuilder setIndexerState(IndexerState indexerState) { + ClientTransformIndexerBuilder setIndexerState(IndexerState indexerState) { this.indexerState = indexerState; return this; } - ClientDataFrameIndexerBuilder setInitialPosition(TransformIndexerPosition initialPosition) { + ClientTransformIndexerBuilder setInitialPosition(TransformIndexerPosition initialPosition) { this.initialPosition = initialPosition; return this; } - ClientDataFrameIndexerBuilder setProgress(TransformProgress progress) { + ClientTransformIndexerBuilder setProgress(TransformProgress progress) { this.progress = progress; return this; } - ClientDataFrameIndexerBuilder setLastCheckpoint(TransformCheckpoint lastCheckpoint) { + ClientTransformIndexerBuilder setLastCheckpoint(TransformCheckpoint lastCheckpoint) { this.lastCheckpoint = lastCheckpoint; return this; } - ClientDataFrameIndexerBuilder setNextCheckpoint(TransformCheckpoint nextCheckpoint) { + ClientTransformIndexerBuilder setNextCheckpoint(TransformCheckpoint nextCheckpoint) { this.nextCheckpoint = nextCheckpoint; return this; } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/SourceDestValidator.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/SourceDestValidator.java index e3a0eb14a4f89..8c89ffd6d5f55 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/SourceDestValidator.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/SourceDestValidator.java @@ -78,7 +78,7 @@ public void validate(TransformConfig config, src); if (concreteNames.length == 0) { throw new ElasticsearchStatusException( - TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_SOURCE_INDEX_MISSING, src), + TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_SOURCE_INDEX_MISSING, src), RestStatus.BAD_REQUEST); } } @@ -104,7 +104,7 @@ public void validate(TransformConfig config, src); if (Regex.simpleMatch(src, destIndex)) { throw new ElasticsearchStatusException( - TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_DEST_IN_SOURCE, destIndex, src), + TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_DEST_IN_SOURCE, destIndex, src), RestStatus.BAD_REQUEST); } concreteSourceIndexNames.addAll(Arrays.asList(concreteNames)); @@ -112,7 +112,7 @@ public void validate(TransformConfig config, if (concreteSourceIndexNames.contains(destIndex)) { throw new ElasticsearchStatusException( - TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_DEST_IN_SOURCE, + TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_DEST_IN_SOURCE, destIndex, Strings.arrayToCommaDelimitedString(config.getSource().getIndex())), RestStatus.BAD_REQUEST @@ -124,7 +124,7 @@ public void validate(TransformConfig config, destIndex); if (concreteDest.length > 0 && concreteSourceIndexNames.contains(concreteDest[0])) { throw new ElasticsearchStatusException( - TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_DEST_IN_SOURCE, + TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_DEST_IN_SOURCE, concreteDest[0], Strings.arrayToCommaDelimitedString(concreteSourceIndexNames.toArray(new String[0]))), RestStatus.BAD_REQUEST @@ -150,7 +150,7 @@ public void validate(TransformConfig config, if (concreteDest.length > 1) { throw new ElasticsearchStatusException( - TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_DEST_SINGLE_INDEX, destIndex), + TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_DEST_SINGLE_INDEX, destIndex), RestStatus.BAD_REQUEST ); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/DataFrameIndexer.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformIndexer.java similarity index 97% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/DataFrameIndexer.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformIndexer.java index f40bb07f2a4a5..eef481213b3cf 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/DataFrameIndexer.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformIndexer.java @@ -35,7 +35,7 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformProgress; import org.elasticsearch.xpack.core.transform.utils.ExceptionsHelper; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; import org.elasticsearch.xpack.transform.transforms.pivot.Pivot; import java.io.IOException; @@ -51,7 +51,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -public abstract class DataFrameIndexer extends AsyncTwoPhaseIndexer { +public abstract class TransformIndexer extends AsyncTwoPhaseIndexer { /** * RunState is an internal (non-persisted) state that controls the internal logic @@ -70,10 +70,10 @@ private enum RunState { } public static final int MINIMUM_PAGE_SIZE = 10; - public static final String COMPOSITE_AGGREGATION_NAME = "_data_frame"; - private static final Logger logger = LogManager.getLogger(DataFrameIndexer.class); + public static final String COMPOSITE_AGGREGATION_NAME = "_transform"; + private static final Logger logger = LogManager.getLogger(TransformIndexer.class); - protected final DataFrameAuditor auditor; + protected final TransformAuditor auditor; protected volatile TransformConfig transformConfig; protected volatile TransformProgress progress; @@ -90,8 +90,8 @@ private enum RunState { private volatile Map> changedBuckets; private volatile Map changedBucketsAfterKey; - public DataFrameIndexer(Executor executor, - DataFrameAuditor auditor, + public TransformIndexer(Executor executor, + TransformAuditor auditor, TransformConfig transformConfig, Map fieldMappings, AtomicReference initialState, @@ -475,12 +475,12 @@ protected boolean handleCircuitBreakingException(Exception e) { int newPageSize = (int) Math.round(reducingFactor * pageSize); if (newPageSize < MINIMUM_PAGE_SIZE) { - String message = TransformMessages.getMessage(TransformMessages.LOG_DATA_FRAME_TRANSFORM_PIVOT_LOW_PAGE_SIZE_FAILURE, pageSize); + String message = TransformMessages.getMessage(TransformMessages.LOG_TRANSFORM_PIVOT_LOW_PAGE_SIZE_FAILURE, pageSize); failIndexer(message); return true; } - String message = TransformMessages.getMessage(TransformMessages.LOG_DATA_FRAME_TRANSFORM_PIVOT_REDUCE_PAGE_SIZE, pageSize, + String message = TransformMessages.getMessage(TransformMessages.LOG_TRANSFORM_PIVOT_REDUCE_PAGE_SIZE, pageSize, newPageSize); auditor.info(getJobId(), message); logger.info("Data frame transform [" + getJobId() + "]:" + message); diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/DataFrameTransformPersistentTasksExecutor.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformPersistentTasksExecutor.java similarity index 81% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/DataFrameTransformPersistentTasksExecutor.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformPersistentTasksExecutor.java index 12b6da1e9d78f..5616e828dd247 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/DataFrameTransformPersistentTasksExecutor.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformPersistentTasksExecutor.java @@ -33,16 +33,16 @@ import org.elasticsearch.xpack.core.transform.TransformField; import org.elasticsearch.xpack.core.transform.TransformMessages; import org.elasticsearch.xpack.core.transform.action.StartTransformAction; -import org.elasticsearch.xpack.core.transform.transforms.Transform; +import org.elasticsearch.xpack.core.transform.transforms.TransformTaskParams; import org.elasticsearch.xpack.core.transform.transforms.TransformCheckpoint; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformState; import org.elasticsearch.xpack.core.transform.transforms.TransformStoredDoc; -import org.elasticsearch.xpack.transform.DataFrame; -import org.elasticsearch.xpack.transform.checkpoint.DataFrameTransformsCheckpointService; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.Transform; +import org.elasticsearch.xpack.transform.checkpoint.TransformCheckpointService; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import org.elasticsearch.xpack.transform.persistence.SeqNoPrimaryTermAndIndex; import org.elasticsearch.xpack.transform.transforms.pivot.SchemaUtil; @@ -52,47 +52,47 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -public class DataFrameTransformPersistentTasksExecutor extends PersistentTasksExecutor { +public class TransformPersistentTasksExecutor extends PersistentTasksExecutor { - private static final Logger logger = LogManager.getLogger(DataFrameTransformPersistentTasksExecutor.class); + private static final Logger logger = LogManager.getLogger(TransformPersistentTasksExecutor.class); // The amount of time we wait for the cluster state to respond when being marked as failed private static final int MARK_AS_FAILED_TIMEOUT_SEC = 90; private final Client client; - private final DataFrameTransformsConfigManager transformsConfigManager; - private final DataFrameTransformsCheckpointService dataFrameTransformsCheckpointService; + private final TransformConfigManager transformsConfigManager; + private final TransformCheckpointService transformCheckpointService; private final SchedulerEngine schedulerEngine; private final ThreadPool threadPool; private final ClusterService clusterService; - private final DataFrameAuditor auditor; + private final TransformAuditor auditor; private volatile int numFailureRetries; - public DataFrameTransformPersistentTasksExecutor(Client client, - DataFrameTransformsConfigManager transformsConfigManager, - DataFrameTransformsCheckpointService dataFrameTransformsCheckpointService, - SchedulerEngine schedulerEngine, - DataFrameAuditor auditor, - ThreadPool threadPool, - ClusterService clusterService, - Settings settings) { - super(TransformField.TASK_NAME, DataFrame.TASK_THREAD_POOL_NAME); + public TransformPersistentTasksExecutor(Client client, + TransformConfigManager transformsConfigManager, + TransformCheckpointService transformsCheckpointService, + SchedulerEngine schedulerEngine, + TransformAuditor auditor, + ThreadPool threadPool, + ClusterService clusterService, + Settings settings) { + super(TransformField.TASK_NAME, Transform.TASK_THREAD_POOL_NAME); this.client = client; this.transformsConfigManager = transformsConfigManager; - this.dataFrameTransformsCheckpointService = dataFrameTransformsCheckpointService; + this.transformCheckpointService = transformsCheckpointService; this.schedulerEngine = schedulerEngine; this.auditor = auditor; this.threadPool = threadPool; this.clusterService = clusterService; - this.numFailureRetries = DataFrameTransformTask.NUM_FAILURE_RETRIES_SETTING.get(settings); + this.numFailureRetries = TransformTask.NUM_FAILURE_RETRIES_SETTING.get(settings); clusterService.getClusterSettings() - .addSettingsUpdateConsumer(DataFrameTransformTask.NUM_FAILURE_RETRIES_SETTING, this::setNumFailureRetries); + .addSettingsUpdateConsumer(TransformTask.NUM_FAILURE_RETRIES_SETTING, this::setNumFailureRetries); } @Override - public PersistentTasksCustomMetaData.Assignment getAssignment(Transform params, ClusterState clusterState) { + public PersistentTasksCustomMetaData.Assignment getAssignment(TransformTaskParams params, ClusterState clusterState) { List unavailableIndices = verifyIndicesPrimaryShardsAreActive(clusterState); if (unavailableIndices.size() != 0) { - String reason = "Not starting data frame transform [" + params.getId() + "], " + + String reason = "Not starting transform [" + params.getId() + "], " + "because not all primary shards are active for the following indices [" + String.join(",", unavailableIndices) + "]"; logger.debug(reason); @@ -108,7 +108,7 @@ static List verifyIndicesPrimaryShardsAreActive(ClusterState clusterStat IndexNameExpressionResolver resolver = new IndexNameExpressionResolver(); String[] indices = resolver.concreteIndexNames(clusterState, IndicesOptions.lenientExpandOpen(), - DataFrameInternalIndex.INDEX_NAME_PATTERN); + TransformInternalIndex.INDEX_NAME_PATTERN); List unavailableIndices = new ArrayList<>(indices.length); for (String index : indices) { IndexRoutingTable routingTable = clusterState.getRoutingTable().index(index); @@ -120,23 +120,23 @@ static List verifyIndicesPrimaryShardsAreActive(ClusterState clusterStat } @Override - protected void nodeOperation(AllocatedPersistentTask task, @Nullable Transform params, PersistentTaskState state) { + protected void nodeOperation(AllocatedPersistentTask task, @Nullable TransformTaskParams params, PersistentTaskState state) { final String transformId = params.getId(); - final DataFrameTransformTask buildTask = (DataFrameTransformTask) task; - // NOTE: DataFrameTransformPersistentTasksExecutor#createTask pulls in the stored task state from the ClusterState when the object - // is created. DataFrameTransformTask#ctor takes into account setting the task as failed if that is passed in with the + final TransformTask buildTask = (TransformTask) task; + // NOTE: TransformPersistentTasksExecutor#createTask pulls in the stored task state from the ClusterState when the object + // is created. TransformTask#ctor takes into account setting the task as failed if that is passed in with the // persisted state. - // DataFrameTransformPersistentTasksExecutor#startTask will fail as DataFrameTransformTask#start, when force == false, will return + // TransformPersistentTasksExecutor#startTask will fail as TransformTask#start, when force == false, will return // a failure indicating that a failed task cannot be started. // // We want the rest of the state to be populated in the task when it is loaded on the node so that users can force start it again // later if they want. - final ClientDataFrameIndexerBuilder indexerBuilder = - new ClientDataFrameIndexerBuilder() + final ClientTransformIndexerBuilder indexerBuilder = + new ClientTransformIndexerBuilder() .setAuditor(auditor) .setClient(client) - .setTransformsCheckpointService(dataFrameTransformsCheckpointService) + .setTransformsCheckpointService(transformCheckpointService) .setTransformsConfigManager(transformsConfigManager); final SetOnce stateHolder = new SetOnce<>(); @@ -144,7 +144,7 @@ protected void nodeOperation(AllocatedPersistentTask task, @Nullable Transform p ActionListener startTaskListener = ActionListener.wrap( response -> logger.info("[{}] successfully completed and scheduled task in node operation", transformId), failure -> { - auditor.error(transformId, "Failed to start data frame transform. " + + auditor.error(transformId, "Failed to start transform. " + "Please stop and attempt to start again. Failure: " + failure.getMessage()); logger.error("Failed to start task ["+ transformId +"] in node operation", failure); } @@ -243,7 +243,7 @@ protected void nodeOperation(AllocatedPersistentTask task, @Nullable Transform p transformsConfigManager.getTransformStoredDoc(transformId, transformStatsActionListener); }, error -> { - String msg = TransformMessages.getMessage(TransformMessages.DATA_FRAME_UNABLE_TO_GATHER_FIELD_MAPPINGS, + String msg = TransformMessages.getMessage(TransformMessages.UNABLE_TO_GATHER_FIELD_MAPPINGS, indexerBuilder.getTransformConfig().getDestination().getIndex()); logger.error(msg, error); markAsFailed(buildTask, msg); @@ -258,7 +258,7 @@ protected void nodeOperation(AllocatedPersistentTask task, @Nullable Transform p SchemaUtil.getDestinationFieldMappings(client, config.getDestination().getIndex(), getFieldMappingsListener); } else { markAsFailed(buildTask, - TransformMessages.getMessage(TransformMessages.DATA_FRAME_TRANSFORM_CONFIGURATION_INVALID, transformId)); + TransformMessages.getMessage(TransformMessages.TRANSFORM_CONFIGURATION_INVALID, transformId)); } }, error -> { @@ -279,7 +279,7 @@ protected void nodeOperation(AllocatedPersistentTask task, @Nullable Transform p ); // <1> Check the internal index template is installed - DataFrameInternalIndex.installLatestVersionedIndexTemplateIfRequired(clusterService, client, templateCheckListener); + TransformInternalIndex.installLatestVersionedIndexTemplateIfRequired(clusterService, client, templateCheckListener); } private static IndexerState currentIndexerState(TransformState previousState) { @@ -302,7 +302,7 @@ private static IndexerState currentIndexerState(TransformState previousState) { } } - private void markAsFailed(DataFrameTransformTask task, String reason) { + private void markAsFailed(TransformTask task, String reason) { CountDownLatch latch = new CountDownLatch(1); task.markAsFailed(reason, new LatchedActionListener<>(ActionListener.wrap( @@ -316,12 +316,12 @@ private void markAsFailed(DataFrameTransformTask task, String reason) { } } - private void startTask(DataFrameTransformTask buildTask, - ClientDataFrameIndexerBuilder indexerBuilder, + private void startTask(TransformTask buildTask, + ClientTransformIndexerBuilder indexerBuilder, Long previousCheckpoint, ActionListener listener) { buildTask.initializeIndexer(indexerBuilder); - // DataFrameTransformTask#start will fail if the task state is FAILED + // TransformTask#start will fail if the task state is FAILED buildTask.setNumFailureRetries(numFailureRetries).start(previousCheckpoint, listener); } @@ -331,8 +331,8 @@ private void setNumFailureRetries(int numFailureRetries) { @Override protected AllocatedPersistentTask createTask(long id, String type, String action, TaskId parentTaskId, - PersistentTasksCustomMetaData.PersistentTask persistentTask, Map headers) { - return new DataFrameTransformTask(id, type, action, parentTaskId, persistentTask.getParams(), + PersistentTasksCustomMetaData.PersistentTask persistentTask, Map headers) { + return new TransformTask(id, type, action, parentTaskId, persistentTask.getParams(), (TransformState) persistentTask.getState(), schedulerEngine, auditor, threadPool, headers); } } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformProgressGatherer.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformProgressGatherer.java index 15cee10181e2d..93bf7ca3d01a3 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformProgressGatherer.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformProgressGatherer.java @@ -41,11 +41,11 @@ public static void getInitialProgress(Client client, SearchRequest request = getSearchRequest(config, filterQuery); ActionListener searchResponseActionListener = ActionListener.wrap( - searchResponse -> progressListener.onResponse(searchResponseToDataFrameTransformProgressFunction().apply(searchResponse)), + searchResponse -> progressListener.onResponse(searchResponseToTransformProgressFunction().apply(searchResponse)), progressListener::onFailure ); ClientHelper.executeWithHeadersAsync(config.getHeaders(), - ClientHelper.DATA_FRAME_ORIGIN, + ClientHelper.TRANSFORM_ORIGIN, client, SearchAction.INSTANCE, request, @@ -72,7 +72,7 @@ public static SearchRequest getSearchRequest(TransformConfig config, QueryBuilde return request; } - public static Function searchResponseToDataFrameTransformProgressFunction() { + public static Function searchResponseToTransformProgressFunction() { return searchResponse -> new TransformProgress(searchResponse.getHits().getTotalHits().value, 0L, 0L); } } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/DataFrameTransformTask.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformTask.java similarity index 87% rename from x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/DataFrameTransformTask.java rename to x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformTask.java index 5d75862a767ed..75054e949bf69 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/DataFrameTransformTask.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/TransformTask.java @@ -29,12 +29,12 @@ import org.elasticsearch.xpack.core.transform.action.StartTransformAction; import org.elasticsearch.xpack.core.transform.transforms.TransformIndexerPosition; import org.elasticsearch.xpack.core.transform.transforms.TransformIndexerStats; -import org.elasticsearch.xpack.core.transform.transforms.Transform; +import org.elasticsearch.xpack.core.transform.transforms.TransformTaskParams; import org.elasticsearch.xpack.core.transform.transforms.TransformCheckpointingInfo; import org.elasticsearch.xpack.core.transform.transforms.TransformState; import org.elasticsearch.xpack.core.transform.transforms.TransformTaskState; -import org.elasticsearch.xpack.transform.checkpoint.DataFrameTransformsCheckpointService; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; +import org.elasticsearch.xpack.transform.checkpoint.TransformCheckpointService; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; import org.elasticsearch.xpack.transform.persistence.SeqNoPrimaryTermAndIndex; import java.util.Arrays; @@ -42,20 +42,20 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; -import static org.elasticsearch.xpack.core.transform.TransformMessages.DATA_FRAME_CANNOT_START_FAILED_TRANSFORM; -import static org.elasticsearch.xpack.core.transform.TransformMessages.DATA_FRAME_CANNOT_STOP_FAILED_TRANSFORM; +import static org.elasticsearch.xpack.core.transform.TransformMessages.CANNOT_START_FAILED_TRANSFORM; +import static org.elasticsearch.xpack.core.transform.TransformMessages.CANNOT_STOP_FAILED_TRANSFORM; -public class DataFrameTransformTask extends AllocatedPersistentTask implements SchedulerEngine.Listener { +public class TransformTask extends AllocatedPersistentTask implements SchedulerEngine.Listener { // Default interval the scheduler sends an event if the config does not specify a frequency private static final long SCHEDULER_NEXT_MILLISECONDS = 60000; - private static final Logger logger = LogManager.getLogger(DataFrameTransformTask.class); + private static final Logger logger = LogManager.getLogger(TransformTask.class); private static final int DEFAULT_FAILURE_RETRIES = 10; private volatile int numFailureRetries = DEFAULT_FAILURE_RETRIES; // How many times the transform task can retry on an non-critical failure public static final Setting NUM_FAILURE_RETRIES_SETTING = Setting.intSetting( - "xpack.data_frame.num_transform_failure_retries", + "xpack.transform.num_transform_failure_retries", DEFAULT_FAILURE_RETRIES, 0, 100, @@ -64,24 +64,24 @@ public class DataFrameTransformTask extends AllocatedPersistentTask implements S private static final IndexerState[] RUNNING_STATES = new IndexerState[]{IndexerState.STARTED, IndexerState.INDEXING}; public static final String SCHEDULE_NAME = TransformField.TASK_NAME + "/schedule"; - private final Transform transform; + private final TransformTaskParams transform; private final SchedulerEngine schedulerEngine; private final ThreadPool threadPool; - private final DataFrameAuditor auditor; + private final TransformAuditor auditor; private final TransformIndexerPosition initialPosition; private final IndexerState initialIndexerState; - private final SetOnce indexer = new SetOnce<>(); + private final SetOnce indexer = new SetOnce<>(); private final AtomicReference taskState; private final AtomicReference stateReason; private final AtomicReference seqNoPrimaryTermAndIndex = new AtomicReference<>(null); - // the checkpoint of this data frame, storing the checkpoint until data indexing from source to dest is _complete_ + // the checkpoint of this transform, storing the checkpoint until data indexing from source to dest is _complete_ // Note: Each indexer run creates a new future checkpoint which becomes the current checkpoint only after the indexer run finished private final AtomicLong currentCheckpoint; - public DataFrameTransformTask(long id, String type, String action, TaskId parentTask, Transform transform, - TransformState state, SchedulerEngine schedulerEngine, DataFrameAuditor auditor, + public TransformTask(long id, String type, String action, TaskId parentTask, TransformTaskParams transform, + TransformState state, SchedulerEngine schedulerEngine, TransformAuditor auditor, ThreadPool threadPool, Map headers) { super(id, type, action, TransformField.PERSISTENT_TASK_DESCRIPTION_PREFIX + transform.getId(), parentTask, headers); this.transform = transform; @@ -129,7 +129,7 @@ public Status getStatus() { return getState(); } - private ClientDataFrameIndexer getIndexer() { + private ClientTransformIndexer getIndexer() { return indexer.get(); } @@ -169,9 +169,9 @@ long incrementCheckpoint() { return currentCheckpoint.getAndIncrement(); } - public void getCheckpointingInfo(DataFrameTransformsCheckpointService transformsCheckpointService, + public void getCheckpointingInfo(TransformCheckpointService transformsCheckpointService, ActionListener listener) { - ClientDataFrameIndexer indexer = getIndexer(); + ClientTransformIndexer indexer = getIndexer(); if (indexer == null) { transformsCheckpointService.getCheckpointingInfo( transform.getId(), @@ -201,7 +201,7 @@ public void getCheckpointingInfo(DataFrameTransformsCheckpointService transforms /** * Starts the transform and schedules it to be triggered in the future. * - * NOTE: This should ONLY be called via {@link DataFrameTransformPersistentTasksExecutor} + * NOTE: This should ONLY be called via {@link TransformPersistentTasksExecutor} * * @param startingCheckpoint The starting checkpoint, could null. Null indicates that there is no starting checkpoint * @param listener The listener to alert once started @@ -210,7 +210,7 @@ synchronized void start(Long startingCheckpoint, ActionListener { auditor.info(transform.getId(), - "Updated data frame transform state to [" + state.getTaskState() + "]."); + "Updated transform state to [" + state.getTaskState() + "]."); long now = System.currentTimeMillis(); // kick off the indexer triggered(new Event(schedulerJobName(), now, now)); @@ -269,7 +269,7 @@ synchronized void start(Long startingCheckpoint, ActionListener> listener) { updatePersistentTaskState(state, ActionListener.wrap( success -> { - logger.debug("[{}] successfully updated state for data frame transform to [{}].", transform.getId(), state.toString()); + logger.debug("[{}] successfully updated state for transform to [{}].", transform.getId(), state.toString()); listener.onResponse(success); }, failure -> { - logger.error(new ParameterizedMessage("[{}] failed to update cluster state for data frame transform.", + logger.error(new ParameterizedMessage("[{}] failed to update cluster state for transform.", transform.getId()), failure); listener.onFailure(failure); @@ -381,8 +381,8 @@ synchronized void markAsFailed(String reason, ActionListener listener) { listener.onResponse(null); return; } - // If the indexer is `STOPPING` this means that `DataFrameTransformTask#stop` was called previously, but something caused - // the indexer to fail. Since `ClientDataFrameIndexer#doSaveState` will persist the state to the index once the indexer stops, + // If the indexer is `STOPPING` this means that `TransformTask#stop` was called previously, but something caused + // the indexer to fail. Since `ClientTransformIndexer#doSaveState` will persist the state to the index once the indexer stops, // it is probably best to NOT change the internal state of the task and allow the normal stopping logic to continue. if (getIndexer() != null && getIndexer().getState() == IndexerState.STOPPING) { logger.info("[{}] attempt to fail transform with reason [{}] while it was stopping.", getTransformId(), reason); @@ -403,7 +403,7 @@ synchronized void markAsFailed(String reason, ActionListener listener) { taskState.set(TransformTaskState.FAILED); stateReason.set(reason); TransformState newState = getState(); - // Even though the indexer information is persisted to an index, we still need DataFrameTransformTaskState in the clusterstate + // Even though the indexer information is persisted to an index, we still need TransformTaskState in the clusterstate // This keeps track of STARTED, FAILED, STOPPED // This is because a FAILED state could occur because we failed to read the config from the internal index, which would imply that // we could not read the previous state information from said index. @@ -427,7 +427,7 @@ synchronized void markAsFailed(String reason, ActionListener listener) { */ @Override public synchronized void onCancelled() { - logger.info("[{}] received cancellation request for data frame transform, state: [{}].", + logger.info("[{}] received cancellation request for transform, state: [{}].", getTransformId(), taskState.get()); if (getIndexer() != null && getIndexer().abort()) { @@ -436,7 +436,7 @@ public synchronized void onCancelled() { } } - DataFrameTransformTask setNumFailureRetries(int numFailureRetries) { + TransformTask setNumFailureRetries(int numFailureRetries) { this.numFailureRetries = numFailureRetries; return this; } @@ -457,7 +457,7 @@ private void deregisterSchedulerJob() { } private String schedulerJobName() { - return DataFrameTransformTask.SCHEDULE_NAME + "_" + getTransformId(); + return TransformTask.SCHEDULE_NAME + "_" + getTransformId(); } private SchedulerEngine.Schedule next() { @@ -467,7 +467,7 @@ private SchedulerEngine.Schedule next() { }; } - synchronized void initializeIndexer(ClientDataFrameIndexerBuilder indexerBuilder) { + synchronized void initializeIndexer(ClientTransformIndexerBuilder indexerBuilder) { indexer.set(indexerBuilder.build(this)); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Aggregations.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Aggregations.java index c307789a0a841..effa3eb1e0e5f 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Aggregations.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Aggregations.java @@ -20,7 +20,7 @@ public final class Aggregations { private Aggregations() {} /** - * Supported aggregation by dataframe and corresponding meta information. + * Supported aggregation by transform and corresponding meta information. * * aggregationType - the name of the aggregation as returned by * {@link org.elasticsearch.search.aggregations.BaseAggregationBuilder#getType()}} @@ -62,7 +62,7 @@ public String getTargetMapping() { private static Set aggregationSupported = Stream.of(AggregationType.values()).map(AggregationType::name) .collect(Collectors.toSet()); - public static boolean isSupportedByDataframe(String aggregationType) { + public static boolean isSupportedByTransform(String aggregationType) { return aggregationSupported.contains(aggregationType.toUpperCase(Locale.ROOT)); } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Pivot.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Pivot.java index 94707ad1ab065..33611cbb3a5bc 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Pivot.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Pivot.java @@ -49,7 +49,7 @@ public class Pivot { public static final int DEFAULT_INITIAL_PAGE_SIZE = 500; public static final int TEST_QUERY_PAGE_SIZE = 50; - private static final String COMPOSITE_AGGREGATION_NAME = "_data_frame"; + private static final String COMPOSITE_AGGREGATION_NAME = "_transform"; private static final Logger logger = LogManager.getLogger(Pivot.class); private final PivotConfig config; @@ -72,7 +72,7 @@ public Pivot(PivotConfig config) { public void validateConfig() { for (AggregationBuilder agg : config.getAggregationConfig().getAggregatorFactories()) { - if (Aggregations.isSupportedByDataframe(agg.getType()) == false) { + if (Aggregations.isSupportedByTransform(agg.getType()) == false) { throw new ElasticsearchStatusException("Unsupported aggregation type [" + agg.getType() + "]", RestStatus.BAD_REQUEST); } } @@ -164,7 +164,7 @@ public boolean supportsIncrementalBucketUpdate() { public Stream> extractResults(CompositeAggregation agg, Map fieldTypeMap, - TransformIndexerStats dataFrameIndexerTransformStats) { + TransformIndexerStats transformIndexerStats) { GroupConfig groups = config.getGroupConfig(); Collection aggregationBuilders = config.getAggregationConfig().getAggregatorFactories(); @@ -175,7 +175,7 @@ public Stream> extractResults(CompositeAggregation agg, aggregationBuilders, pipelineAggregationBuilders, fieldTypeMap, - dataFrameIndexerTransformStats); + transformIndexerStats); } public QueryBuilder filterBuckets(Map> changedBuckets) { @@ -239,7 +239,7 @@ private static CompositeAggregationBuilder createCompositeAggregationSources(Piv LoggingDeprecationHandler.INSTANCE, BytesReference.bytes(builder).streamInput()); compositeAggregation = CompositeAggregationBuilder.parse(COMPOSITE_AGGREGATION_NAME, parser); } catch (IOException e) { - throw new RuntimeException(TransformMessages.DATA_FRAME_TRANSFORM_PIVOT_FAILED_TO_CREATE_COMPOSITE_AGGREGATION, e); + throw new RuntimeException(TransformMessages.TRANSFORM_PIVOT_FAILED_TO_CREATE_COMPOSITE_AGGREGATION, e); } return compositeAggregation; } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/SchemaUtil.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/SchemaUtil.java index bc24ed10c075a..e409f923edebd 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/SchemaUtil.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/SchemaUtil.java @@ -123,7 +123,7 @@ public static void getDestinationFieldMappings(final Client client, .fields("*") .indicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN); ClientHelper.executeAsyncWithOrigin(client, - ClientHelper.DATA_FRAME_ORIGIN, + ClientHelper.TRANSFORM_ORIGIN, FieldCapabilitiesAction.INSTANCE, fieldCapabilitiesRequest, ActionListener.wrap( diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/LocalStateDataFrame.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/LocalStateTransform.java similarity index 78% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/LocalStateDataFrame.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/LocalStateTransform.java index 1ea7457e75081..0d2ae10de89c4 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/LocalStateDataFrame.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/LocalStateTransform.java @@ -11,14 +11,14 @@ import java.nio.file.Path; -public class LocalStateDataFrame extends LocalStateCompositeXPackPlugin { +public class LocalStateTransform extends LocalStateCompositeXPackPlugin { - public LocalStateDataFrame(final Settings settings, final Path configPath) throws Exception { + public LocalStateTransform(final Settings settings, final Path configPath) throws Exception { super(settings, configPath); @SuppressWarnings("resource") - LocalStateDataFrame thisVar = this; + LocalStateTransform thisVar = this; - plugins.add(new DataFrame(settings) { + plugins.add(new Transform(settings) { @Override protected XPackLicenseState getLicenseState() { return thisVar.getLicenseState(); diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/DataFrameInfoTransportActionTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/TransformInfoTransportActionTests.java similarity index 87% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/DataFrameInfoTransportActionTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/TransformInfoTransportActionTests.java index 44db822479426..6b99a60e10c1b 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/DataFrameInfoTransportActionTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/TransformInfoTransportActionTests.java @@ -35,13 +35,13 @@ import java.util.Map; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.xpack.transform.DataFrameInfoTransportAction.PROVIDED_STATS; +import static org.elasticsearch.xpack.transform.TransformInfoTransportAction.PROVIDED_STATS; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.core.Is.is; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class DataFrameInfoTransportActionTests extends ESTestCase { +public class TransformInfoTransportActionTests extends ESTestCase { private XPackLicenseState licenseState; @Before @@ -50,24 +50,24 @@ public void init() { } public void testAvailable() { - DataFrameInfoTransportAction featureSet = new DataFrameInfoTransportAction( + TransformInfoTransportAction featureSet = new TransformInfoTransportAction( mock(TransportService.class), mock(ActionFilters.class), Settings.EMPTY, licenseState); boolean available = randomBoolean(); - when(licenseState.isDataFrameAllowed()).thenReturn(available); + when(licenseState.isTransformAllowed()).thenReturn(available); assertThat(featureSet.available(), is(available)); } public void testEnabledSetting() { boolean enabled = randomBoolean(); Settings.Builder settings = Settings.builder(); - settings.put("xpack.data_frame.enabled", enabled); - DataFrameInfoTransportAction featureSet = new DataFrameInfoTransportAction( + settings.put("xpack.transform.enabled", enabled); + TransformInfoTransportAction featureSet = new TransformInfoTransportAction( mock(TransportService.class), mock(ActionFilters.class), settings.build(), licenseState); assertThat(featureSet.enabled(), is(enabled)); } public void testEnabledDefault() { - DataFrameInfoTransportAction featureSet = new DataFrameInfoTransportAction( + TransformInfoTransportAction featureSet = new TransformInfoTransportAction( mock(TransportService.class), mock(ActionFilters.class), Settings.EMPTY, licenseState); assertTrue(featureSet.enabled()); } @@ -77,7 +77,7 @@ public void testParseSearchAggs() { SearchResponse withEmptyAggs = mock(SearchResponse.class); when(withEmptyAggs.getAggregations()).thenReturn(emptyAggs); - assertThat(DataFrameInfoTransportAction.parseSearchAggs(withEmptyAggs), + assertThat(TransformInfoTransportAction.parseSearchAggs(withEmptyAggs), equalTo(new TransformIndexerStats())); TransformIndexerStats expectedStats = new TransformIndexerStats( @@ -101,7 +101,7 @@ public void testParseSearchAggs() { SearchResponse withAggs = mock(SearchResponse.class); when(withAggs.getAggregations()).thenReturn(aggregations); - assertThat(DataFrameInfoTransportAction.parseSearchAggs(withAggs), equalTo(expectedStats)); + assertThat(TransformInfoTransportAction.parseSearchAggs(withAggs), equalTo(expectedStats)); } private static Aggregation buildAgg(String name, double value) { @@ -112,10 +112,10 @@ private static Aggregation buildAgg(String name, double value) { } public void testUsageDisabled() throws IOException, InterruptedException, ExecutionException { - when(licenseState.isDataFrameAllowed()).thenReturn(true); + when(licenseState.isTransformAllowed()).thenReturn(true); Settings.Builder settings = Settings.builder(); - settings.put("xpack.data_frame.enabled", false); - var usageAction = new DataFrameUsageTransportAction(mock(TransportService.class), null, null, + settings.put("xpack.transform.enabled", false); + var usageAction = new TransformUsageTransportAction(mock(TransportService.class), null, null, mock(ActionFilters.class), null, settings.build(), licenseState, mock(Client.class)); PlainActionFuture future = new PlainActionFuture<>(); usageAction.masterOperation(null, null, mock(ClusterState.class), future); diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/DataFrameSingleNodeTestCase.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/TransformSingleNodeTestCase.java similarity index 87% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/DataFrameSingleNodeTestCase.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/TransformSingleNodeTestCase.java index 60be7e1204d04..5cdbba8e12284 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/DataFrameSingleNodeTestCase.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/TransformSingleNodeTestCase.java @@ -15,7 +15,7 @@ import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.xpack.core.template.TemplateUtils; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; import org.junit.Before; import java.util.Collection; @@ -25,14 +25,14 @@ import static org.hamcrest.Matchers.equalTo; -public abstract class DataFrameSingleNodeTestCase extends ESSingleNodeTestCase { +public abstract class TransformSingleNodeTestCase extends ESSingleNodeTestCase { @Before public void waitForTemplates() throws Exception { assertBusy(() -> { ClusterState state = client().admin().cluster().prepareState().get().getState(); - assertTrue("Timed out waiting for the data frame templates to be installed", TemplateUtils - .checkTemplateExistsAndVersionIsGTECurrentVersion(DataFrameInternalIndex.LATEST_INDEX_VERSIONED_NAME, state)); + assertTrue("Timed out waiting for the transform templates to be installed", TemplateUtils + .checkTemplateExistsAndVersionIsGTECurrentVersion(TransformInternalIndex.LATEST_INDEX_VERSIONED_NAME, state)); }); } @@ -46,7 +46,7 @@ protected Settings nodeSettings() { @Override protected Collection> getPlugins() { - return pluginList(LocalStateDataFrame.class, ReindexPlugin.class); + return pluginList(LocalStateTransform.class, ReindexPlugin.class); } protected void assertAsync(Consumer> function, T expected, CheckedConsumer onAnswer, diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/DataFrameNodesTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/TransformNodesTests.java similarity index 78% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/DataFrameNodesTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/TransformNodesTests.java index 05b53a2c51f1f..2ce3d8f882a27 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/DataFrameNodesTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/TransformNodesTests.java @@ -16,25 +16,25 @@ import org.elasticsearch.persistent.PersistentTasksCustomMetaData; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.core.transform.TransformField; -import org.elasticsearch.xpack.core.transform.transforms.Transform; +import org.elasticsearch.xpack.core.transform.transforms.TransformTaskParams; import java.util.Arrays; import java.util.Collections; import static org.hamcrest.Matchers.hasItemInArray; -public class DataFrameNodesTests extends ESTestCase { +public class TransformNodesTests extends ESTestCase { - public void testDataframeNodes() { - String dataFrameIdFoo = "df-id-foo"; - String dataFrameIdBar = "df-id-bar"; + public void testTransformNodes() { + String transformIdFoo = "df-id-foo"; + String transformIdBar = "df-id-bar"; PersistentTasksCustomMetaData.Builder tasksBuilder = PersistentTasksCustomMetaData.builder(); - tasksBuilder.addTask(dataFrameIdFoo, - TransformField.TASK_NAME, new Transform(dataFrameIdFoo, Version.CURRENT, null), + tasksBuilder.addTask(transformIdFoo, + TransformField.TASK_NAME, new TransformTaskParams(transformIdFoo, Version.CURRENT, null), new PersistentTasksCustomMetaData.Assignment("node-1", "test assignment")); - tasksBuilder.addTask(dataFrameIdBar, - TransformField.TASK_NAME, new Transform(dataFrameIdBar, Version.CURRENT, null), + tasksBuilder.addTask(transformIdBar, + TransformField.TASK_NAME, new TransformTaskParams(transformIdBar, Version.CURRENT, null), new PersistentTasksCustomMetaData.Assignment("node-2", "test assignment")); tasksBuilder.addTask("test-task1", "testTasks", new PersistentTaskParams() { @Override @@ -63,15 +63,15 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) { .metaData(MetaData.builder().putCustom(PersistentTasksCustomMetaData.TYPE, tasksBuilder.build())) .build(); - String[] nodes = DataFrameNodes.dataFrameTaskNodes(Arrays.asList(dataFrameIdFoo, dataFrameIdBar), cs); + String[] nodes = TransformNodes.transformTaskNodes(Arrays.asList(transformIdFoo, transformIdBar), cs); assertEquals(2, nodes.length); assertThat(nodes, hasItemInArray("node-1")); assertThat(nodes, hasItemInArray("node-2")); } - public void testDataframeNodes_NoTasks() { + public void testTransformNodes_NoTasks() { ClusterState emptyState = ClusterState.builder(new ClusterName("_name")).build(); - String[] nodes = DataFrameNodes.dataFrameTaskNodes(Collections.singletonList("df-id"), emptyState); + String[] nodes = TransformNodes.transformTaskNodes(Collections.singletonList("df-id"), emptyState); assertEquals(0, nodes.length); } } diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/TransportStopDataFrameTransformActionTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/TransportStopTransformActionTests.java similarity index 73% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/TransportStopDataFrameTransformActionTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/TransportStopTransformActionTests.java index 5de09509d7ead..9fcc44d7389e5 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/TransportStopDataFrameTransformActionTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/action/TransportStopTransformActionTests.java @@ -14,7 +14,7 @@ import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.core.indexing.IndexerState; import org.elasticsearch.xpack.core.transform.TransformMessages; -import org.elasticsearch.xpack.core.transform.transforms.Transform; +import org.elasticsearch.xpack.core.transform.transforms.TransformTaskParams; import org.elasticsearch.xpack.core.transform.transforms.TransformState; import org.elasticsearch.xpack.core.transform.transforms.TransformTaskState; @@ -24,7 +24,7 @@ import static org.elasticsearch.rest.RestStatus.CONFLICT; import static org.hamcrest.Matchers.equalTo; -public class TransportStopDataFrameTransformActionTests extends ESTestCase { +public class TransportStopTransformActionTests extends ESTestCase { private MetaData.Builder buildMetadata(PersistentTasksCustomMetaData ptasks) { return MetaData.builder().putCustom(PersistentTasksCustomMetaData.TYPE, ptasks); @@ -33,23 +33,23 @@ private MetaData.Builder buildMetadata(PersistentTasksCustomMetaData ptasks) { public void testTaskStateValidationWithNoTasks() { MetaData.Builder metaData = MetaData.builder(); ClusterState.Builder csBuilder = ClusterState.builder(new ClusterName("_name")).metaData(metaData); - TransportStopDataFrameTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); + TransportStopTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); PersistentTasksCustomMetaData.Builder pTasksBuilder = PersistentTasksCustomMetaData.builder(); csBuilder = ClusterState.builder(new ClusterName("_name")).metaData(buildMetadata(pTasksBuilder.build())); - TransportStopDataFrameTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); + TransportStopTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); } - public void testTaskStateValidationWithDataFrameTasks() { + public void testTaskStateValidationWithTransformTasks() { // Test with the task state being null PersistentTasksCustomMetaData.Builder pTasksBuilder = PersistentTasksCustomMetaData.builder() .addTask("non-failed-task", - Transform.NAME, - new Transform("data-frame-task-1", Version.CURRENT, null), + TransformTaskParams.NAME, + new TransformTaskParams("transform-task-1", Version.CURRENT, null), new PersistentTasksCustomMetaData.Assignment("current-data-node-with-1-tasks", "")); ClusterState.Builder csBuilder = ClusterState.builder(new ClusterName("_name")).metaData(buildMetadata(pTasksBuilder.build())); - TransportStopDataFrameTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); + TransportStopTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); // test again with a non failed task but this time it has internal state pTasksBuilder.updateTaskState("non-failed-task", new TransformState(TransformTaskState.STOPPED, @@ -60,11 +60,11 @@ public void testTaskStateValidationWithDataFrameTasks() { null)); csBuilder = ClusterState.builder(new ClusterName("_name")).metaData(buildMetadata(pTasksBuilder.build())); - TransportStopDataFrameTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); + TransportStopTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); pTasksBuilder.addTask("failed-task", - Transform.NAME, - new Transform("data-frame-task-1", Version.CURRENT, null), + TransformTaskParams.NAME, + new TransformTaskParams("transform-task-1", Version.CURRENT, null), new PersistentTasksCustomMetaData.Assignment("current-data-node-with-1-tasks", "")) .updateTaskState("failed-task", new TransformState(TransformTaskState.FAILED, IndexerState.STOPPED, @@ -74,19 +74,19 @@ public void testTaskStateValidationWithDataFrameTasks() { null)); csBuilder = ClusterState.builder(new ClusterName("_name")).metaData(buildMetadata(pTasksBuilder.build())); - TransportStopDataFrameTransformAction.validateTaskState(csBuilder.build(), Arrays.asList("non-failed-task", "failed-task"), true); + TransportStopTransformAction.validateTaskState(csBuilder.build(), Arrays.asList("non-failed-task", "failed-task"), true); - TransportStopDataFrameTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); + TransportStopTransformAction.validateTaskState(csBuilder.build(), Collections.singletonList("non-failed-task"), false); ClusterState.Builder csBuilderFinal = ClusterState.builder(new ClusterName("_name")).metaData(buildMetadata(pTasksBuilder.build())); ElasticsearchStatusException ex = expectThrows(ElasticsearchStatusException.class, - () -> TransportStopDataFrameTransformAction.validateTaskState(csBuilderFinal.build(), + () -> TransportStopTransformAction.validateTaskState(csBuilderFinal.build(), Collections.singletonList("failed-task"), false)); assertThat(ex.status(), equalTo(CONFLICT)); assertThat(ex.getMessage(), - equalTo(TransformMessages.getMessage(TransformMessages.DATA_FRAME_CANNOT_STOP_FAILED_TRANSFORM, + equalTo(TransformMessages.getMessage(TransformMessages.CANNOT_STOP_FAILED_TRANSFORM, "failed-task", "task has failed"))); } diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DefaultCheckpointProviderTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DefaultCheckpointProviderTests.java index 414f8d0fee486..9a81dcd812a24 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DefaultCheckpointProviderTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DefaultCheckpointProviderTests.java @@ -17,9 +17,9 @@ import org.elasticsearch.test.MockLogAppender.LoggingExpectation; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformConfigTests; -import org.elasticsearch.xpack.transform.notifications.MockDataFrameAuditor; -import org.elasticsearch.xpack.transform.notifications.MockDataFrameAuditor.AuditExpectation; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.notifications.MockTransformAuditor; +import org.elasticsearch.xpack.transform.notifications.MockTransformAuditor.AuditExpectation; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import org.junit.Before; import java.util.Collections; @@ -31,25 +31,25 @@ public class DefaultCheckpointProviderTests extends ESTestCase { private Client client; - private MockDataFrameAuditor dataFrameAuditor; - private DataFrameTransformsConfigManager dataFrameTransformsConfigManager; + private MockTransformAuditor transformAuditor; + private TransformConfigManager transformConfigManager; private Logger checkpointProviderlogger = LogManager.getLogger(DefaultCheckpointProvider.class); @Before public void setUpMocks() throws IllegalAccessException { client = mock(Client.class); - dataFrameTransformsConfigManager = mock(DataFrameTransformsConfigManager.class); - dataFrameAuditor = new MockDataFrameAuditor(); + transformConfigManager = mock(TransformConfigManager.class); + transformAuditor = new MockTransformAuditor(); } public void testReportSourceIndexChangesRunsEmpty() throws Exception { String transformId = getTestName(); - TransformConfig transformConfig = TransformConfigTests.randomDataFrameTransformConfig(transformId); + TransformConfig transformConfig = TransformConfigTests.randomTransformConfig(transformId); DefaultCheckpointProvider provider = new DefaultCheckpointProvider( client, - dataFrameTransformsConfigManager, - dataFrameAuditor, + transformConfigManager, + transformAuditor, transformConfig); assertExpectation( @@ -57,7 +57,7 @@ public void testReportSourceIndexChangesRunsEmpty() throws Exception { checkpointProviderlogger.getName(), Level.WARN, "Source did not resolve to any open indexes for transform [" + transformId + "]"), - new MockDataFrameAuditor.SeenAuditExpectation("warn when source is empty", + new MockTransformAuditor.SeenAuditExpectation("warn when source is empty", org.elasticsearch.xpack.core.common.notifications.Level.WARNING, transformId, "Source did not resolve to any open indexes"), @@ -70,7 +70,7 @@ public void testReportSourceIndexChangesRunsEmpty() throws Exception { checkpointProviderlogger.getName(), Level.WARN, "Source did not resolve to any concrete indexes"), - new MockDataFrameAuditor.UnseenAuditExpectation("do not warn if empty again", + new MockTransformAuditor.UnseenAuditExpectation("do not warn if empty again", org.elasticsearch.xpack.core.common.notifications.Level.WARNING, transformId, "Source did not resolve to any concrete indexes"), @@ -81,12 +81,12 @@ public void testReportSourceIndexChangesRunsEmpty() throws Exception { public void testReportSourceIndexChangesAddDelete() throws Exception { String transformId = getTestName(); - TransformConfig transformConfig = TransformConfigTests.randomDataFrameTransformConfig(transformId); + TransformConfig transformConfig = TransformConfigTests.randomTransformConfig(transformId); DefaultCheckpointProvider provider = new DefaultCheckpointProvider( client, - dataFrameTransformsConfigManager, - dataFrameAuditor, + transformConfigManager, + transformAuditor, transformConfig); assertExpectation( @@ -95,7 +95,7 @@ public void testReportSourceIndexChangesAddDelete() throws Exception { Level.DEBUG, "Source index resolve found changes, removedIndexes: [index], new indexes: [other_index] for transform [" + transformId + "]"), - new MockDataFrameAuditor.SeenAuditExpectation("info about adds/removal", + new MockTransformAuditor.SeenAuditExpectation("info about adds/removal", org.elasticsearch.xpack.core.common.notifications.Level.INFO, transformId, "Source index resolve found changes, removedIndexes: [index], new indexes: [other_index]"), @@ -109,7 +109,7 @@ public void testReportSourceIndexChangesAddDelete() throws Exception { Level.DEBUG, "Source index resolve found changes, removedIndexes: [index], new indexes: [] for transform [" + transformId + "]"), - new MockDataFrameAuditor.SeenAuditExpectation("info about adds/removal", + new MockTransformAuditor.SeenAuditExpectation("info about adds/removal", org.elasticsearch.xpack.core.common.notifications.Level.INFO, transformId, "Source index resolve found changes, removedIndexes: [index], new indexes: []"), @@ -122,7 +122,7 @@ public void testReportSourceIndexChangesAddDelete() throws Exception { Level.DEBUG, "Source index resolve found changes, removedIndexes: [], new indexes: [other_index] for transform [" + transformId + "]"), - new MockDataFrameAuditor.SeenAuditExpectation("info about adds/removal", + new MockTransformAuditor.SeenAuditExpectation("info about adds/removal", org.elasticsearch.xpack.core.common.notifications.Level.INFO, transformId, "Source index resolve found changes, removedIndexes: [], new indexes: [other_index]"), @@ -133,12 +133,12 @@ public void testReportSourceIndexChangesAddDelete() throws Exception { public void testReportSourceIndexChangesAddDeleteMany() throws Exception { String transformId = getTestName(); - TransformConfig transformConfig = TransformConfigTests.randomDataFrameTransformConfig(transformId); + TransformConfig transformConfig = TransformConfigTests.randomTransformConfig(transformId); DefaultCheckpointProvider provider = new DefaultCheckpointProvider( client, - dataFrameTransformsConfigManager, - dataFrameAuditor, + transformConfigManager, + transformAuditor, transformConfig); HashSet oldSet = new HashSet<>(); @@ -156,7 +156,7 @@ public void testReportSourceIndexChangesAddDeleteMany() throws Exception { Level.DEBUG, "Source index resolve found more than 10 changes, [50] removed indexes, [50] new indexes for transform [" + transformId + "]"), - new MockDataFrameAuditor.SeenAuditExpectation("info about adds/removal", + new MockTransformAuditor.SeenAuditExpectation("info about adds/removal", org.elasticsearch.xpack.core.common.notifications.Level.INFO, transformId, "Source index resolve found more than 10 changes, [50] removed indexes, [50] new indexes"), @@ -175,13 +175,13 @@ private void assertExpectation(LoggingExpectation loggingExpectation, mockLogAppender.addExpectation(loggingExpectation); // always start fresh - dataFrameAuditor.reset(); - dataFrameAuditor.addExpectation(auditExpectation); + transformAuditor.reset(); + transformAuditor.addExpectation(auditExpectation); try { Loggers.addAppender(checkpointProviderlogger, mockLogAppender); codeBlock.run(); mockLogAppender.assertAllExpectationsMatched(); - dataFrameAuditor.assertAllExpectationsMatched(); + transformAuditor.assertAllExpectationsMatched(); } finally { Loggers.removeAppender(checkpointProviderlogger, mockLogAppender); mockLogAppender.stop(); diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DataFrameTransformCheckpointServiceNodeTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/TransformCheckpointServiceNodeTests.java similarity index 92% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DataFrameTransformCheckpointServiceNodeTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/TransformCheckpointServiceNodeTests.java index de9b9d7b9e8a7..300ad34e5cbe9 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DataFrameTransformCheckpointServiceNodeTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/TransformCheckpointServiceNodeTests.java @@ -47,9 +47,9 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformConfigTests; import org.elasticsearch.xpack.core.transform.transforms.TransformProgress; import org.elasticsearch.xpack.core.transform.transforms.TransformProgressTests; -import org.elasticsearch.xpack.transform.DataFrameSingleNodeTestCase; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.TransformSingleNodeTestCase; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import org.junit.AfterClass; import org.junit.Before; @@ -65,15 +65,15 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class DataFrameTransformCheckpointServiceNodeTests extends DataFrameSingleNodeTestCase { +public class TransformCheckpointServiceNodeTests extends TransformSingleNodeTestCase { // re-use the mock client for the whole test suite as the underlying thread pool and the // corresponding context if recreated cause unreliable test execution // see https://github.com/elastic/elasticsearch/issues/45238 and https://github.com/elastic/elasticsearch/issues/42577 private static MockClientForCheckpointing mockClientForCheckpointing = null; - private DataFrameTransformsConfigManager transformsConfigManager; - private DataFrameTransformsCheckpointService transformsCheckpointService; + private TransformConfigManager transformsConfigManager; + private TransformCheckpointService transformsCheckpointService; private class MockClientForCheckpointing extends NoOpClient { @@ -127,14 +127,14 @@ void doExecute(ActionType action, Request request, ActionListener transformsConfigManager - .putTransformConfiguration(TransformConfigTests.randomDataFrameTransformConfig(transformId), listener), + .putTransformConfiguration(TransformConfigTests.randomTransformConfig(transformId), listener), true, null, null); // by design no exception is thrown but an empty checkpoint is returned @@ -190,13 +190,13 @@ public void testCreateReadDeleteCheckpoint() throws InterruptedException { public void testGetCheckpointStats() throws InterruptedException { String transformId = randomAlphaOfLengthBetween(3, 10); long timestamp = 1000; - TransformIndexerPosition position = TransformIndexerPositionTests.randomDataFrameIndexerPosition(); - TransformProgress progress = TransformProgressTests.randomDataFrameTransformProgress(); + TransformIndexerPosition position = TransformIndexerPositionTests.randomTransformIndexerPosition(); + TransformProgress progress = TransformProgressTests.randomTransformProgress(); // create transform assertAsync( listener -> transformsConfigManager - .putTransformConfiguration(TransformConfigTests.randomDataFrameTransformConfig(transformId), listener), + .putTransformConfiguration(TransformConfigTests.randomTransformConfig(transformId), listener), true, null, null); TransformCheckpoint checkpoint = new TransformCheckpoint(transformId, timestamp, 1L, diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DataFrameTransformsCheckpointServiceTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/TransformsCheckpointServiceTests.java similarity index 99% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DataFrameTransformsCheckpointServiceTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/TransformsCheckpointServiceTests.java index 2633dd340317e..d343dd5e0066e 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DataFrameTransformsCheckpointServiceTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/TransformsCheckpointServiceTests.java @@ -45,7 +45,7 @@ import static org.hamcrest.Matchers.containsString; -public class DataFrameTransformsCheckpointServiceTests extends ESTestCase { +public class TransformsCheckpointServiceTests extends ESTestCase { public void testExtractIndexCheckpoints() { Map expectedCheckpoints = new HashMap<>(); diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/notifications/MockDataFrameAuditor.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/notifications/MockTransformAuditor.java similarity index 97% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/notifications/MockDataFrameAuditor.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/notifications/MockTransformAuditor.java index 88384d52d4575..7e6a7ba12e76b 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/notifications/MockDataFrameAuditor.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/notifications/MockTransformAuditor.java @@ -24,11 +24,11 @@ * * TODO: ideally this would be a generalized MockAuditor, but the current inheritance doesn't let us */ -public class MockDataFrameAuditor extends DataFrameAuditor { +public class MockTransformAuditor extends TransformAuditor { private List expectations; - public MockDataFrameAuditor() { + public MockTransformAuditor() { super(mock(Client.class), "mock_node_name"); expectations = new CopyOnWriteArrayList<>(); } diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/DataFrameTransformsConfigManagerTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformConfigManagerTests.java similarity index 61% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/DataFrameTransformsConfigManagerTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformConfigManagerTests.java index 6e1579455034b..c4f1f94144cb4 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/DataFrameTransformsConfigManagerTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformConfigManagerTests.java @@ -26,7 +26,7 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformConfigTests; import org.elasticsearch.xpack.core.transform.transforms.TransformStoredDoc; import org.elasticsearch.xpack.core.transform.transforms.TransformStoredDocTests; -import org.elasticsearch.xpack.transform.DataFrameSingleNodeTestCase; +import org.elasticsearch.xpack.transform.TransformSingleNodeTestCase; import org.junit.Before; import java.util.ArrayList; @@ -36,140 +36,140 @@ import java.util.List; import java.util.stream.Collectors; -import static org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex.mappings; -import static org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager.TO_XCONTENT_PARAMS; +import static org.elasticsearch.xpack.transform.persistence.TransformInternalIndex.mappings; +import static org.elasticsearch.xpack.transform.persistence.TransformConfigManager.TO_XCONTENT_PARAMS; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; -public class DataFrameTransformsConfigManagerTests extends DataFrameSingleNodeTestCase { +public class TransformConfigManagerTests extends TransformSingleNodeTestCase { - private DataFrameTransformsConfigManager transformsConfigManager; + private TransformConfigManager transformConfigManager; @Before public void createComponents() { - transformsConfigManager = new DataFrameTransformsConfigManager(client(), xContentRegistry()); + transformConfigManager = new TransformConfigManager(client(), xContentRegistry()); } public void testGetMissingTransform() throws InterruptedException { // the index does not exist yet - assertAsync(listener -> transformsConfigManager.getTransformConfiguration("not_there", listener), (TransformConfig) null, + assertAsync(listener -> transformConfigManager.getTransformConfiguration("not_there", listener), (TransformConfig) null, null, e -> { assertEquals(ResourceNotFoundException.class, e.getClass()); - assertEquals(TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, "not_there"), + assertEquals(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, "not_there"), e.getMessage()); }); // create one transform and test with an existing index assertAsync( - listener -> transformsConfigManager - .putTransformConfiguration(TransformConfigTests.randomDataFrameTransformConfig(), listener), + listener -> transformConfigManager + .putTransformConfiguration(TransformConfigTests.randomTransformConfig(), listener), true, null, null); // same test, but different code path - assertAsync(listener -> transformsConfigManager.getTransformConfiguration("not_there", listener), (TransformConfig) null, + assertAsync(listener -> transformConfigManager.getTransformConfiguration("not_there", listener), (TransformConfig) null, null, e -> { assertEquals(ResourceNotFoundException.class, e.getClass()); - assertEquals(TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, "not_there"), + assertEquals(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, "not_there"), e.getMessage()); }); } public void testDeleteMissingTransform() throws InterruptedException { // the index does not exist yet - assertAsync(listener -> transformsConfigManager.deleteTransform("not_there", listener), (Boolean) null, null, e -> { + assertAsync(listener -> transformConfigManager.deleteTransform("not_there", listener), (Boolean) null, null, e -> { assertEquals(ResourceNotFoundException.class, e.getClass()); - assertEquals(TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, "not_there"), e.getMessage()); + assertEquals(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, "not_there"), e.getMessage()); }); // create one transform and test with an existing index assertAsync( - listener -> transformsConfigManager - .putTransformConfiguration(TransformConfigTests.randomDataFrameTransformConfig(), listener), + listener -> transformConfigManager + .putTransformConfiguration(TransformConfigTests.randomTransformConfig(), listener), true, null, null); // same test, but different code path - assertAsync(listener -> transformsConfigManager.deleteTransform("not_there", listener), (Boolean) null, null, e -> { + assertAsync(listener -> transformConfigManager.deleteTransform("not_there", listener), (Boolean) null, null, e -> { assertEquals(ResourceNotFoundException.class, e.getClass()); - assertEquals(TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, "not_there"), e.getMessage()); + assertEquals(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, "not_there"), e.getMessage()); }); } public void testCreateReadDeleteTransform() throws InterruptedException { - TransformConfig transformConfig = TransformConfigTests.randomDataFrameTransformConfig(); + TransformConfig transformConfig = TransformConfigTests.randomTransformConfig(); // create transform - assertAsync(listener -> transformsConfigManager.putTransformConfiguration(transformConfig, listener), true, null, null); + assertAsync(listener -> transformConfigManager.putTransformConfiguration(transformConfig, listener), true, null, null); // read transform - assertAsync(listener -> transformsConfigManager.getTransformConfiguration(transformConfig.getId(), listener), transformConfig, null, + assertAsync(listener -> transformConfigManager.getTransformConfiguration(transformConfig.getId(), listener), transformConfig, null, null); // try to create again - assertAsync(listener -> transformsConfigManager.putTransformConfiguration(transformConfig, listener), (Boolean) null, null, e -> { + assertAsync(listener -> transformConfigManager.putTransformConfiguration(transformConfig, listener), (Boolean) null, null, e -> { assertEquals(ResourceAlreadyExistsException.class, e.getClass()); - assertEquals(TransformMessages.getMessage(TransformMessages.REST_PUT_DATA_FRAME_TRANSFORM_EXISTS, transformConfig.getId()), + assertEquals(TransformMessages.getMessage(TransformMessages.REST_PUT_TRANSFORM_EXISTS, transformConfig.getId()), e.getMessage()); }); // delete transform - assertAsync(listener -> transformsConfigManager.deleteTransform(transformConfig.getId(), listener), true, null, null); + assertAsync(listener -> transformConfigManager.deleteTransform(transformConfig.getId(), listener), true, null, null); // delete again - assertAsync(listener -> transformsConfigManager.deleteTransform(transformConfig.getId(), listener), (Boolean) null, null, e -> { + assertAsync(listener -> transformConfigManager.deleteTransform(transformConfig.getId(), listener), (Boolean) null, null, e -> { assertEquals(ResourceNotFoundException.class, e.getClass()); - assertEquals(TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, transformConfig.getId()), + assertEquals(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, transformConfig.getId()), e.getMessage()); }); // try to get deleted transform - assertAsync(listener -> transformsConfigManager.getTransformConfiguration(transformConfig.getId(), listener), + assertAsync(listener -> transformConfigManager.getTransformConfiguration(transformConfig.getId(), listener), (TransformConfig) null, null, e -> { assertEquals(ResourceNotFoundException.class, e.getClass()); - assertEquals(TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, transformConfig.getId()), + assertEquals(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, transformConfig.getId()), e.getMessage()); }); } public void testCreateReadDeleteCheckPoint() throws InterruptedException { - TransformCheckpoint checkpoint = TransformCheckpointTests.randomDataFrameTransformCheckpoints(); + TransformCheckpoint checkpoint = TransformCheckpointTests.randomTransformCheckpoints(); // create - assertAsync(listener -> transformsConfigManager.putTransformCheckpoint(checkpoint, listener), true, null, null); + assertAsync(listener -> transformConfigManager.putTransformCheckpoint(checkpoint, listener), true, null, null); // read - assertAsync(listener -> transformsConfigManager.getTransformCheckpoint(checkpoint.getTransformId(), checkpoint.getCheckpoint(), + assertAsync(listener -> transformConfigManager.getTransformCheckpoint(checkpoint.getTransformId(), checkpoint.getCheckpoint(), listener), checkpoint, null, null); // delete - assertAsync(listener -> transformsConfigManager.deleteTransform(checkpoint.getTransformId(), listener), true, null, null); + assertAsync(listener -> transformConfigManager.deleteTransform(checkpoint.getTransformId(), listener), true, null, null); // delete again - assertAsync(listener -> transformsConfigManager.deleteTransform(checkpoint.getTransformId(), listener), (Boolean) null, null, e -> { + assertAsync(listener -> transformConfigManager.deleteTransform(checkpoint.getTransformId(), listener), (Boolean) null, null, e -> { assertEquals(ResourceNotFoundException.class, e.getClass()); - assertEquals(TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, checkpoint.getTransformId()), + assertEquals(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, checkpoint.getTransformId()), e.getMessage()); }); // getting a non-existing checkpoint returns null - assertAsync(listener -> transformsConfigManager.getTransformCheckpoint(checkpoint.getTransformId(), checkpoint.getCheckpoint(), + assertAsync(listener -> transformConfigManager.getTransformCheckpoint(checkpoint.getTransformId(), checkpoint.getCheckpoint(), listener), TransformCheckpoint.EMPTY, null, null); } public void testExpandIds() throws Exception { - TransformConfig transformConfig1 = TransformConfigTests.randomDataFrameTransformConfig("transform1_expand"); - TransformConfig transformConfig2 = TransformConfigTests.randomDataFrameTransformConfig("transform2_expand"); - TransformConfig transformConfig3 = TransformConfigTests.randomDataFrameTransformConfig("transform3_expand"); + TransformConfig transformConfig1 = TransformConfigTests.randomTransformConfig("transform1_expand"); + TransformConfig transformConfig2 = TransformConfigTests.randomTransformConfig("transform2_expand"); + TransformConfig transformConfig3 = TransformConfigTests.randomTransformConfig("transform3_expand"); // create transform - assertAsync(listener -> transformsConfigManager.putTransformConfiguration(transformConfig1, listener), true, null, null); - assertAsync(listener -> transformsConfigManager.putTransformConfiguration(transformConfig2, listener), true, null, null); - assertAsync(listener -> transformsConfigManager.putTransformConfiguration(transformConfig3, listener), true, null, null); + assertAsync(listener -> transformConfigManager.putTransformConfiguration(transformConfig1, listener), true, null, null); + assertAsync(listener -> transformConfigManager.putTransformConfiguration(transformConfig2, listener), true, null, null); + assertAsync(listener -> transformConfigManager.putTransformConfiguration(transformConfig3, listener), true, null, null); // expand 1 id assertAsync(listener -> - transformsConfigManager.expandTransformIds(transformConfig1.getId(), + transformConfigManager.expandTransformIds(transformConfig1.getId(), PageParams.defaultParams(), true, listener), @@ -179,7 +179,7 @@ public void testExpandIds() throws Exception { // expand 2 ids explicitly assertAsync(listener -> - transformsConfigManager.expandTransformIds("transform1_expand,transform2_expand", + transformConfigManager.expandTransformIds("transform1_expand,transform2_expand", PageParams.defaultParams(), true, listener), @@ -189,7 +189,7 @@ public void testExpandIds() throws Exception { // expand 3 ids wildcard and explicit assertAsync(listener -> - transformsConfigManager.expandTransformIds("transform1*,transform2_expand,transform3_expand", + transformConfigManager.expandTransformIds("transform1*,transform2_expand,transform3_expand", PageParams.defaultParams(), true, listener), @@ -199,7 +199,7 @@ public void testExpandIds() throws Exception { // expand 3 ids _all assertAsync(listener -> - transformsConfigManager.expandTransformIds("_all", + transformConfigManager.expandTransformIds("_all", PageParams.defaultParams(), true, listener), @@ -209,7 +209,7 @@ public void testExpandIds() throws Exception { // expand 1 id _all with pagination assertAsync(listener -> - transformsConfigManager.expandTransformIds("_all", + transformConfigManager.expandTransformIds("_all", new PageParams(0, 1), true, listener), @@ -219,7 +219,7 @@ public void testExpandIds() throws Exception { // expand 2 later ids _all with pagination assertAsync(listener -> - transformsConfigManager.expandTransformIds("_all", + transformConfigManager.expandTransformIds("_all", new PageParams(1, 2), true, listener), @@ -229,7 +229,7 @@ public void testExpandIds() throws Exception { // expand 1 id explicitly that does not exist assertAsync(listener -> - transformsConfigManager.expandTransformIds("unknown,unknown2", + transformConfigManager.expandTransformIds("unknown,unknown2", new PageParams(1, 2), true, listener), @@ -238,12 +238,12 @@ public void testExpandIds() throws Exception { e -> { assertThat(e, instanceOf(ResourceNotFoundException.class)); assertThat(e.getMessage(), - equalTo(TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, "unknown,unknown2"))); + equalTo(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, "unknown,unknown2"))); }); // expand 1 id implicitly that does not exist assertAsync(listener -> - transformsConfigManager.expandTransformIds("unknown*", + transformConfigManager.expandTransformIds("unknown*", new PageParams(1, 2), false, listener), @@ -252,7 +252,7 @@ public void testExpandIds() throws Exception { e -> { assertThat(e, instanceOf(ResourceNotFoundException.class)); assertThat(e.getMessage(), - equalTo(TransformMessages.getMessage(TransformMessages.REST_DATA_FRAME_UNKNOWN_TRANSFORM, "unknown*"))); + equalTo(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, "unknown*"))); }); } @@ -260,35 +260,35 @@ public void testExpandIds() throws Exception { public void testStoredDoc() throws InterruptedException { String transformId = "transform_test_stored_doc_create_read_update"; - TransformStoredDoc storedDocs = TransformStoredDocTests.randomDataFrameTransformStoredDoc(transformId); - SeqNoPrimaryTermAndIndex firstIndex = new SeqNoPrimaryTermAndIndex(0, 1, DataFrameInternalIndex.LATEST_INDEX_NAME); + TransformStoredDoc storedDocs = TransformStoredDocTests.randomTransformStoredDoc(transformId); + SeqNoPrimaryTermAndIndex firstIndex = new SeqNoPrimaryTermAndIndex(0, 1, TransformInternalIndex.LATEST_INDEX_NAME); - assertAsync(listener -> transformsConfigManager.putOrUpdateTransformStoredDoc(storedDocs, null, listener), + assertAsync(listener -> transformConfigManager.putOrUpdateTransformStoredDoc(storedDocs, null, listener), firstIndex, null, null); - assertAsync(listener -> transformsConfigManager.getTransformStoredDoc(transformId, listener), + assertAsync(listener -> transformConfigManager.getTransformStoredDoc(transformId, listener), Tuple.tuple(storedDocs, firstIndex), null, null); - SeqNoPrimaryTermAndIndex secondIndex = new SeqNoPrimaryTermAndIndex(1, 1, DataFrameInternalIndex.LATEST_INDEX_NAME); - TransformStoredDoc updated = TransformStoredDocTests.randomDataFrameTransformStoredDoc(transformId); - assertAsync(listener -> transformsConfigManager.putOrUpdateTransformStoredDoc(updated, firstIndex, listener), + SeqNoPrimaryTermAndIndex secondIndex = new SeqNoPrimaryTermAndIndex(1, 1, TransformInternalIndex.LATEST_INDEX_NAME); + TransformStoredDoc updated = TransformStoredDocTests.randomTransformStoredDoc(transformId); + assertAsync(listener -> transformConfigManager.putOrUpdateTransformStoredDoc(updated, firstIndex, listener), secondIndex, null, null); - assertAsync(listener -> transformsConfigManager.getTransformStoredDoc(transformId, listener), + assertAsync(listener -> transformConfigManager.getTransformStoredDoc(transformId, listener), Tuple.tuple(updated, secondIndex), null, null); - assertAsync(listener -> transformsConfigManager.putOrUpdateTransformStoredDoc(updated, firstIndex, listener), + assertAsync(listener -> transformConfigManager.putOrUpdateTransformStoredDoc(updated, firstIndex, listener), (SeqNoPrimaryTermAndIndex)null, r -> fail("did not fail with version conflict."), e -> assertThat( e.getMessage(), - equalTo("Failed to persist data frame statistics for transform [transform_test_stored_doc_create_read_update]")) + equalTo("Failed to persist transform statistics for transform [transform_test_stored_doc_create_read_update]")) ); } @@ -297,11 +297,11 @@ public void testGetStoredDocMultiple() throws InterruptedException { List expectedDocs = new ArrayList<>(); for (int i=0; i transformsConfigManager.putOrUpdateTransformStoredDoc(stat, null, listener), + assertAsync(listener -> transformConfigManager.putOrUpdateTransformStoredDoc(stat, null, listener), initialSeqNo, null, null); @@ -315,15 +315,15 @@ public void testGetStoredDocMultiple() throws InterruptedException { // returned docs will be ordered by id expectedDocs.sort(Comparator.comparing(TransformStoredDoc::getId)); - assertAsync(listener -> transformsConfigManager.getTransformStoredDoc(ids, listener), expectedDocs, null, null); + assertAsync(listener -> transformConfigManager.getTransformStoredDoc(ids, listener), expectedDocs, null, null); } public void testDeleteOldTransformConfigurations() throws Exception { - String oldIndex = DataFrameInternalIndex.INDEX_PATTERN + "1"; + String oldIndex = TransformInternalIndex.INDEX_PATTERN + "1"; String transformId = "transform_test_delete_old_configurations"; String docId = TransformConfig.documentId(transformId); TransformConfig transformConfig = TransformConfigTests - .randomDataFrameTransformConfig("transform_test_delete_old_configurations"); + .randomTransformConfig("transform_test_delete_old_configurations"); client().admin().indices().create(new CreateIndexRequest(oldIndex) .mapping(MapperService.SINGLE_MAPPING_NAME, mappings())).actionGet(); @@ -336,29 +336,29 @@ public void testDeleteOldTransformConfigurations() throws Exception { client().index(request).actionGet(); } - assertAsync(listener -> transformsConfigManager.putTransformConfiguration(transformConfig, listener), true, null, null); + assertAsync(listener -> transformConfigManager.putTransformConfiguration(transformConfig, listener), true, null, null); assertThat(client().get(new GetRequest(oldIndex).id(docId)).actionGet().isExists(), is(true)); - assertThat(client().get(new GetRequest(DataFrameInternalIndex.LATEST_INDEX_NAME).id(docId)).actionGet().isExists(), is(true)); + assertThat(client().get(new GetRequest(TransformInternalIndex.LATEST_INDEX_NAME).id(docId)).actionGet().isExists(), is(true)); - assertAsync(listener -> transformsConfigManager.deleteOldTransformConfigurations(transformId, listener), true, null, null); + assertAsync(listener -> transformConfigManager.deleteOldTransformConfigurations(transformId, listener), true, null, null); - client().admin().indices().refresh(new RefreshRequest(DataFrameInternalIndex.INDEX_NAME_PATTERN)).actionGet(); + client().admin().indices().refresh(new RefreshRequest(TransformInternalIndex.INDEX_NAME_PATTERN)).actionGet(); assertThat(client().get(new GetRequest(oldIndex).id(docId)).actionGet().isExists(), is(false)); - assertThat(client().get(new GetRequest(DataFrameInternalIndex.LATEST_INDEX_NAME).id(docId)).actionGet().isExists(), is(true)); + assertThat(client().get(new GetRequest(TransformInternalIndex.LATEST_INDEX_NAME).id(docId)).actionGet().isExists(), is(true)); } public void testDeleteOldTransformStoredDocuments() throws Exception { - String oldIndex = DataFrameInternalIndex.INDEX_PATTERN + "1"; + String oldIndex = TransformInternalIndex.INDEX_PATTERN + "1"; String transformId = "transform_test_delete_old_stored_documents"; String docId = TransformStoredDoc.documentId(transformId); - TransformStoredDoc dataFrameTransformStoredDoc = TransformStoredDocTests - .randomDataFrameTransformStoredDoc(transformId); + TransformStoredDoc transformStoredDoc = TransformStoredDocTests + .randomTransformStoredDoc(transformId); client().admin().indices().create(new CreateIndexRequest(oldIndex) .mapping(MapperService.SINGLE_MAPPING_NAME, mappings())).actionGet(); try(XContentBuilder builder = XContentFactory.jsonBuilder()) { - XContentBuilder source = dataFrameTransformStoredDoc.toXContent(builder, new ToXContent.MapParams(TO_XCONTENT_PARAMS)); + XContentBuilder source = transformStoredDoc.toXContent(builder, new ToXContent.MapParams(TO_XCONTENT_PARAMS)); IndexRequest request = new IndexRequest(oldIndex) .source(source) .id(docId); @@ -366,25 +366,25 @@ public void testDeleteOldTransformStoredDocuments() throws Exception { } // Put when referencing the old index should create the doc in the new index, even if we have seqNo|primaryTerm info - assertAsync(listener -> transformsConfigManager.putOrUpdateTransformStoredDoc(dataFrameTransformStoredDoc, + assertAsync(listener -> transformConfigManager.putOrUpdateTransformStoredDoc(transformStoredDoc, new SeqNoPrimaryTermAndIndex(3, 1, oldIndex), listener), - new SeqNoPrimaryTermAndIndex(0, 1, DataFrameInternalIndex.LATEST_INDEX_NAME), + new SeqNoPrimaryTermAndIndex(0, 1, TransformInternalIndex.LATEST_INDEX_NAME), null, null); - client().admin().indices().refresh(new RefreshRequest(DataFrameInternalIndex.INDEX_NAME_PATTERN)).actionGet(); + client().admin().indices().refresh(new RefreshRequest(TransformInternalIndex.INDEX_NAME_PATTERN)).actionGet(); assertThat(client().get(new GetRequest(oldIndex).id(docId)).actionGet().isExists(), is(true)); - assertThat(client().get(new GetRequest(DataFrameInternalIndex.LATEST_INDEX_NAME).id(docId)).actionGet().isExists(), is(true)); + assertThat(client().get(new GetRequest(TransformInternalIndex.LATEST_INDEX_NAME).id(docId)).actionGet().isExists(), is(true)); - assertAsync(listener -> transformsConfigManager.deleteOldTransformStoredDocuments(transformId, listener), + assertAsync(listener -> transformConfigManager.deleteOldTransformStoredDocuments(transformId, listener), true, null, null); - client().admin().indices().refresh(new RefreshRequest(DataFrameInternalIndex.INDEX_NAME_PATTERN)).actionGet(); + client().admin().indices().refresh(new RefreshRequest(TransformInternalIndex.INDEX_NAME_PATTERN)).actionGet(); assertThat(client().get(new GetRequest(oldIndex).id(docId)).actionGet().isExists(), is(false)); - assertThat(client().get(new GetRequest(DataFrameInternalIndex.LATEST_INDEX_NAME).id(docId)).actionGet().isExists(), is(true)); + assertThat(client().get(new GetRequest(TransformInternalIndex.LATEST_INDEX_NAME).id(docId)).actionGet().isExists(), is(true)); } } diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/DataframeIndexTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformIndexTests.java similarity index 86% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/DataframeIndexTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformIndexTests.java index afd738af33aae..866f2359121d5 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/DataframeIndexTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformIndexTests.java @@ -32,11 +32,11 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -public class DataframeIndexTests extends ESTestCase { +public class TransformIndexTests extends ESTestCase { private static final String TRANSFORM_ID = "some-random-transform-id"; private static final int CURRENT_TIME_MILLIS = 123456789; - private static final String CREATED_BY = "data-frame-transform"; + private static final String CREATED_BY = "transform"; private Client client = mock(Client.class); private Clock clock = Clock.fixed(Instant.ofEpochMilli(CURRENT_TIME_MILLIS), ZoneId.systemDefault()); @@ -51,10 +51,10 @@ public void testCreateDestinationIndex() throws IOException { }) .when(client).execute(any(), any(), any()); - DataframeIndex.createDestinationIndex( + TransformIndex.createDestinationIndex( client, clock, - TransformConfigTests.randomDataFrameTransformConfig(TRANSFORM_ID), + TransformConfigTests.randomTransformConfig(TRANSFORM_ID), new HashMap<>(), ActionListener.wrap( value -> assertTrue(value), @@ -67,8 +67,8 @@ public void testCreateDestinationIndex() throws IOException { CreateIndexRequest createIndexRequest = createIndexRequestCaptor.getValue(); try (XContentParser parser = createParser(JsonXContent.jsonXContent, createIndexRequest.mappings().get("_doc"))) { Map map = parser.map(); - assertThat(extractValue("_doc._meta._data_frame.transform", map), equalTo(TRANSFORM_ID)); - assertThat(extractValue("_doc._meta._data_frame.creation_date_in_millis", map), equalTo(CURRENT_TIME_MILLIS)); + assertThat(extractValue("_doc._meta._transform.transform", map), equalTo(TRANSFORM_ID)); + assertThat(extractValue("_doc._meta._transform.creation_date_in_millis", map), equalTo(CURRENT_TIME_MILLIS)); assertThat(extractValue("_doc._meta.created_by", map), equalTo(CREATED_BY)); } } diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/DataFrameInternalIndexTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java similarity index 90% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/DataFrameInternalIndexTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java index e61dbffa08af5..23249ca4fbf83 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/DataFrameInternalIndexTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java @@ -34,14 +34,14 @@ import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -public class DataFrameInternalIndexTests extends ESTestCase { +public class TransformInternalIndexTests extends ESTestCase { public static ClusterState STATE_WITH_LATEST_VERSIONED_INDEX_TEMPLATE; static { ImmutableOpenMap.Builder mapBuilder = ImmutableOpenMap.builder(); try { - mapBuilder.put(DataFrameInternalIndex.LATEST_INDEX_VERSIONED_NAME, DataFrameInternalIndex.getIndexTemplateMetaData()); + mapBuilder.put(TransformInternalIndex.LATEST_INDEX_VERSIONED_NAME, TransformInternalIndex.getIndexTemplateMetaData()); } catch (IOException e) { throw new UncheckedIOException(e); } @@ -54,21 +54,21 @@ public class DataFrameInternalIndexTests extends ESTestCase { public void testHaveLatestVersionedIndexTemplate() { - assertTrue(DataFrameInternalIndex.haveLatestVersionedIndexTemplate(STATE_WITH_LATEST_VERSIONED_INDEX_TEMPLATE)); - assertFalse(DataFrameInternalIndex.haveLatestVersionedIndexTemplate(ClusterState.EMPTY_STATE)); + assertTrue(TransformInternalIndex.haveLatestVersionedIndexTemplate(STATE_WITH_LATEST_VERSIONED_INDEX_TEMPLATE)); + assertFalse(TransformInternalIndex.haveLatestVersionedIndexTemplate(ClusterState.EMPTY_STATE)); } public void testInstallLatestVersionedIndexTemplateIfRequired_GivenNotRequired() { ClusterService clusterService = mock(ClusterService.class); - when(clusterService.state()).thenReturn(DataFrameInternalIndexTests.STATE_WITH_LATEST_VERSIONED_INDEX_TEMPLATE); + when(clusterService.state()).thenReturn(TransformInternalIndexTests.STATE_WITH_LATEST_VERSIONED_INDEX_TEMPLATE); Client client = mock(Client.class); AtomicBoolean gotResponse = new AtomicBoolean(false); ActionListener testListener = ActionListener.wrap(aVoid -> gotResponse.set(true), e -> fail(e.getMessage())); - DataFrameInternalIndex.installLatestVersionedIndexTemplateIfRequired(clusterService, client, testListener); + TransformInternalIndex.installLatestVersionedIndexTemplateIfRequired(clusterService, client, testListener); assertTrue(gotResponse.get()); verifyNoMoreInteractions(client); @@ -100,7 +100,7 @@ public void testInstallLatestVersionedIndexTemplateIfRequired_GivenRequired() { AtomicBoolean gotResponse = new AtomicBoolean(false); ActionListener testListener = ActionListener.wrap(aVoid -> gotResponse.set(true), e -> fail(e.getMessage())); - DataFrameInternalIndex.installLatestVersionedIndexTemplateIfRequired(clusterService, client, testListener); + TransformInternalIndex.installLatestVersionedIndexTemplateIfRequired(clusterService, client, testListener); assertTrue(gotResponse.get()); verify(client, times(1)).threadPool(); diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteDataFrameTransformActionTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformActionTests.java similarity index 84% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteDataFrameTransformActionTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformActionTests.java index 055d781f79ff3..36891461c2702 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteDataFrameTransformActionTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/rest/action/RestDeleteTransformActionTests.java @@ -19,10 +19,10 @@ import static org.hamcrest.Matchers.equalTo; import static org.mockito.Mockito.mock; -public class RestDeleteDataFrameTransformActionTests extends ESTestCase { +public class RestDeleteTransformActionTests extends ESTestCase { public void testBodyRejection() throws Exception { - final RestDeleteDataFrameTransformAction handler = new RestDeleteDataFrameTransformAction( + final RestDeleteTransformAction handler = new RestDeleteTransformAction( mock(RestController.class)); try (XContentBuilder builder = JsonXContent.contentBuilder()) { builder.startObject(); @@ -36,7 +36,7 @@ public void testBodyRejection() throws Exception { IllegalArgumentException e = expectThrows( IllegalArgumentException.class, () -> handler.prepareRequest(request, mock(NodeClient.class))); - assertThat(e.getMessage(), equalTo("delete data frame transforms requests can not have a request body")); + assertThat(e.getMessage(), equalTo("delete transform requests can not have a request body")); } } diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/ClientDataFrameIndexerTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/ClientTransformIndexerTests.java similarity index 85% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/ClientDataFrameIndexerTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/ClientTransformIndexerTests.java index 0745af2a97fbd..99a454c5f1a31 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/ClientDataFrameIndexerTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/ClientTransformIndexerTests.java @@ -13,12 +13,12 @@ import org.elasticsearch.xpack.core.indexing.IndexerState; import org.elasticsearch.xpack.core.scheduler.SchedulerEngine; import org.elasticsearch.xpack.core.transform.transforms.TransformIndexerStats; -import org.elasticsearch.xpack.core.transform.transforms.Transform; +import org.elasticsearch.xpack.core.transform.transforms.TransformTaskParams; import org.elasticsearch.xpack.core.transform.transforms.TransformCheckpoint; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.transform.checkpoint.CheckpointProvider; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import java.time.Instant; import java.util.Collections; @@ -31,28 +31,28 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class ClientDataFrameIndexerTests extends ESTestCase { +public class ClientTransformIndexerTests extends ESTestCase { public void testAudiOnFinishFrequency() { ThreadPool threadPool = mock(ThreadPool.class); when(threadPool.executor("generic")).thenReturn(mock(ExecutorService.class)); - DataFrameTransformTask parentTask = new DataFrameTransformTask(1, - "dataframe", + TransformTask parentTask = new TransformTask(1, + "transform", "ptask", - new TaskId("dataframe:1"), - mock(Transform.class), + new TaskId("transform:1"), + mock(TransformTaskParams.class), null, mock(SchedulerEngine.class), - mock(DataFrameAuditor.class), + mock(TransformAuditor.class), threadPool, Collections.emptyMap()); - ClientDataFrameIndexer indexer = new ClientDataFrameIndexer( - mock(DataFrameTransformsConfigManager.class), + ClientTransformIndexer indexer = new ClientTransformIndexer( + mock(TransformConfigManager.class), mock(CheckpointProvider.class), new AtomicReference<>(IndexerState.STOPPED), null, mock(Client.class), - mock(DataFrameAuditor.class), + mock(TransformAuditor.class), mock(TransformIndexerStats.class), mock(TransformConfig.class), Collections.emptyMap(), diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/SourceDestValidatorTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/SourceDestValidatorTests.java index 796def8678b22..add6a0c27b908 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/SourceDestValidatorTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/SourceDestValidatorTests.java @@ -64,12 +64,12 @@ public class SourceDestValidatorTests extends ESTestCase { } public void testCheck_GivenSimpleSourceIndexAndValidDestIndex() { - TransformConfig config = createDataFrameTransform(new SourceConfig(SOURCE_1), new DestConfig("dest", null)); + TransformConfig config = createTransform(new SourceConfig(SOURCE_1), new DestConfig("dest", null)); SourceDestValidator.validate(config, CLUSTER_STATE, new IndexNameExpressionResolver(), false); } public void testCheck_GivenMissingConcreteSourceIndex() { - TransformConfig config = createDataFrameTransform(new SourceConfig("missing"), new DestConfig("dest", null)); + TransformConfig config = createTransform(new SourceConfig("missing"), new DestConfig("dest", null)); ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, () -> SourceDestValidator.validate(config, CLUSTER_STATE, new IndexNameExpressionResolver(), false)); @@ -79,7 +79,7 @@ public void testCheck_GivenMissingConcreteSourceIndex() { } public void testCheck_GivenMissingWildcardSourceIndex() { - TransformConfig config = createDataFrameTransform(new SourceConfig("missing*"), new DestConfig("dest", null)); + TransformConfig config = createTransform(new SourceConfig("missing*"), new DestConfig("dest", null)); ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, () -> SourceDestValidator.validate(config, CLUSTER_STATE, new IndexNameExpressionResolver(), false)); @@ -89,7 +89,7 @@ public void testCheck_GivenMissingWildcardSourceIndex() { } public void testCheck_GivenDestIndexSameAsSourceIndex() { - TransformConfig config = createDataFrameTransform(new SourceConfig(SOURCE_1), new DestConfig("source-1", null)); + TransformConfig config = createTransform(new SourceConfig(SOURCE_1), new DestConfig("source-1", null)); ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, () -> SourceDestValidator.validate(config, CLUSTER_STATE, new IndexNameExpressionResolver(), false)); @@ -99,7 +99,7 @@ public void testCheck_GivenDestIndexSameAsSourceIndex() { } public void testCheck_GivenDestIndexMatchesSourceIndex() { - TransformConfig config = createDataFrameTransform(new SourceConfig("source-*"), new DestConfig(SOURCE_2, null)); + TransformConfig config = createTransform(new SourceConfig("source-*"), new DestConfig(SOURCE_2, null)); ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, () -> SourceDestValidator.validate(config, CLUSTER_STATE, new IndexNameExpressionResolver(), false)); @@ -109,7 +109,7 @@ public void testCheck_GivenDestIndexMatchesSourceIndex() { } public void testCheck_GivenDestIndexMatchesOneOfSourceIndices() { - TransformConfig config = createDataFrameTransform(new SourceConfig("source-1", "source-*"), + TransformConfig config = createTransform(new SourceConfig("source-1", "source-*"), new DestConfig(SOURCE_2, null)); ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, @@ -120,7 +120,7 @@ public void testCheck_GivenDestIndexMatchesOneOfSourceIndices() { } public void testCheck_GivenDestIndexIsAliasThatMatchesMultipleIndices() { - TransformConfig config = createDataFrameTransform(new SourceConfig(SOURCE_1), new DestConfig("dest-alias", null)); + TransformConfig config = createTransform(new SourceConfig(SOURCE_1), new DestConfig("dest-alias", null)); ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, () -> SourceDestValidator.validate(config, CLUSTER_STATE, new IndexNameExpressionResolver(), false)); @@ -136,7 +136,7 @@ public void testCheck_GivenDestIndexIsAliasThatMatchesMultipleIndices() { } public void testCheck_GivenDestIndexIsAliasThatIsIncludedInSource() { - TransformConfig config = createDataFrameTransform(new SourceConfig(SOURCE_1), new DestConfig("source-1-alias", null)); + TransformConfig config = createTransform(new SourceConfig(SOURCE_1), new DestConfig("source-1-alias", null)); ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, () -> SourceDestValidator.validate(config, CLUSTER_STATE, new IndexNameExpressionResolver(), false)); @@ -147,7 +147,7 @@ public void testCheck_GivenDestIndexIsAliasThatIsIncludedInSource() { SourceDestValidator.validate(config, CLUSTER_STATE, new IndexNameExpressionResolver(), true); } - private static TransformConfig createDataFrameTransform(SourceConfig sourceConfig, DestConfig destConfig) { + private static TransformConfig createTransform(SourceConfig sourceConfig, DestConfig destConfig) { return new TransformConfig("test", sourceConfig, destConfig, diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/DataFrameIndexerTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformIndexerTests.java similarity index 94% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/DataFrameIndexerTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformIndexerTests.java index 4071535fe1aab..528c49eb1dacf 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/DataFrameIndexerTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformIndexerTests.java @@ -36,7 +36,7 @@ import org.elasticsearch.xpack.core.transform.transforms.pivot.AggregationConfigTests; import org.elasticsearch.xpack.core.transform.transforms.pivot.GroupConfigTests; import org.elasticsearch.xpack.core.transform.transforms.pivot.PivotConfig; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; import org.elasticsearch.xpack.transform.transforms.pivot.Pivot; import org.junit.Before; @@ -65,11 +65,11 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class DataFrameIndexerTests extends ESTestCase { +public class TransformIndexerTests extends ESTestCase { private Client client; - class MockedDataFrameIndexer extends DataFrameIndexer { + class MockedTransformIndexer extends TransformIndexer { private final Function searchFunction; private final Function bulkFunction; @@ -78,11 +78,11 @@ class MockedDataFrameIndexer extends DataFrameIndexer { // used for synchronizing with the test private CountDownLatch latch; - MockedDataFrameIndexer( + MockedTransformIndexer( Executor executor, TransformConfig transformConfig, Map fieldMappings, - DataFrameAuditor auditor, + TransformAuditor auditor, AtomicReference initialState, TransformIndexerPosition initialPosition, TransformIndexerStats jobStats, @@ -90,7 +90,7 @@ class MockedDataFrameIndexer extends DataFrameIndexer { Function bulkFunction, Consumer failureConsumer) { super(executor, auditor, transformConfig, fieldMappings, initialState, initialPosition, jobStats, - /* DataFrameTransformProgress */ null, TransformCheckpoint.EMPTY, TransformCheckpoint.EMPTY); + /* TransformProgress */ null, TransformCheckpoint.EMPTY, TransformCheckpoint.EMPTY); this.searchFunction = searchFunction; this.bulkFunction = bulkFunction; this.failureConsumer = failureConsumer; @@ -153,7 +153,7 @@ protected void doSaveState(IndexerState state, TransformIndexerPosition position @Override protected void onFailure(Exception exc) { try { - // mimic same behavior as {@link DataFrameTransformTask} + // mimic same behavior as {@link TransformTask} if (handleCircuitBreakingException(exc)) { return; } @@ -223,9 +223,9 @@ public void testPageSizeAdapt() throws InterruptedException { final ExecutorService executor = Executors.newFixedThreadPool(1); try { - DataFrameAuditor auditor = new DataFrameAuditor(client, "node_1"); + TransformAuditor auditor = new TransformAuditor(client, "node_1"); - MockedDataFrameIndexer indexer = new MockedDataFrameIndexer(executor, config, Collections.emptyMap(), auditor, state, null, + MockedTransformIndexer indexer = new MockedTransformIndexer(executor, config, Collections.emptyMap(), auditor, state, null, new TransformIndexerStats(), searchFunction, bulkFunction, failureConsumer); final CountDownLatch latch = indexer.newLatch(1); indexer.start(); @@ -236,7 +236,7 @@ public void testPageSizeAdapt() throws InterruptedException { awaitBusy(() -> indexer.getState() == IndexerState.STOPPED); long pageSizeAfterFirstReduction = indexer.getPageSize(); assertThat(initialPageSize, greaterThan(pageSizeAfterFirstReduction)); - assertThat(pageSizeAfterFirstReduction, greaterThan((long)DataFrameIndexer.MINIMUM_PAGE_SIZE)); + assertThat(pageSizeAfterFirstReduction, greaterThan((long)TransformIndexer.MINIMUM_PAGE_SIZE)); // run indexer a 2nd time final CountDownLatch secondRunLatch = indexer.newLatch(1); @@ -250,7 +250,7 @@ public void testPageSizeAdapt() throws InterruptedException { // assert that page size has been reduced again assertThat(pageSizeAfterFirstReduction, greaterThan((long)indexer.getPageSize())); - assertThat(pageSizeAfterFirstReduction, greaterThan((long)DataFrameIndexer.MINIMUM_PAGE_SIZE)); + assertThat(pageSizeAfterFirstReduction, greaterThan((long)TransformIndexer.MINIMUM_PAGE_SIZE)); } finally { executor.shutdownNow(); @@ -288,9 +288,9 @@ public void testDoProcessAggNullCheck() { final ExecutorService executor = Executors.newFixedThreadPool(1); try { - DataFrameAuditor auditor = mock(DataFrameAuditor.class); + TransformAuditor auditor = mock(TransformAuditor.class); - MockedDataFrameIndexer indexer = new MockedDataFrameIndexer(executor, config, Collections.emptyMap(), auditor, state, null, + MockedTransformIndexer indexer = new MockedTransformIndexer(executor, config, Collections.emptyMap(), auditor, state, null, new TransformIndexerStats(), searchFunction, bulkFunction, failureConsumer); IterationResult newPosition = indexer.doProcess(searchResponse); diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/DataFrameTransformPersistentTasksExecutorTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformPersistentTasksExecutorTests.java similarity index 76% rename from x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/DataFrameTransformPersistentTasksExecutorTests.java rename to x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformPersistentTasksExecutorTests.java index ee16cb774fced..75bf84c51ae82 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/DataFrameTransformPersistentTasksExecutorTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/TransformPersistentTasksExecutorTests.java @@ -30,12 +30,12 @@ import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.core.scheduler.SchedulerEngine; -import org.elasticsearch.xpack.core.transform.transforms.Transform; -import org.elasticsearch.xpack.transform.checkpoint.DataFrameTransformsCheckpointService; -import org.elasticsearch.xpack.transform.notifications.DataFrameAuditor; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndex; -import org.elasticsearch.xpack.transform.persistence.DataFrameInternalIndexTests; -import org.elasticsearch.xpack.transform.persistence.DataFrameTransformsConfigManager; +import org.elasticsearch.xpack.core.transform.transforms.TransformTaskParams; +import org.elasticsearch.xpack.transform.checkpoint.TransformCheckpointService; +import org.elasticsearch.xpack.transform.notifications.TransformAuditor; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndex; +import org.elasticsearch.xpack.transform.persistence.TransformInternalIndexTests; +import org.elasticsearch.xpack.transform.persistence.TransformConfigManager; import java.util.ArrayList; import java.util.Collections; @@ -46,24 +46,24 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class DataFrameTransformPersistentTasksExecutorTests extends ESTestCase { +public class TransformPersistentTasksExecutorTests extends ESTestCase { public void testNodeVersionAssignment() { MetaData.Builder metaData = MetaData.builder(); RoutingTable.Builder routingTable = RoutingTable.builder(); addIndices(metaData, routingTable); PersistentTasksCustomMetaData.Builder pTasksBuilder = PersistentTasksCustomMetaData.builder() - .addTask("data-frame-task-1", - Transform.NAME, - new Transform("data-frame-task-1", Version.CURRENT, null), + .addTask("transform-task-1", + TransformTaskParams.NAME, + new TransformTaskParams("transform-task-1", Version.CURRENT, null), new PersistentTasksCustomMetaData.Assignment("current-data-node-with-1-tasks", "")) - .addTask("data-frame-task-2", - Transform.NAME, - new Transform("data-frame-task-2", Version.CURRENT, null), + .addTask("transform-task-2", + TransformTaskParams.NAME, + new TransformTaskParams("transform-task-2", Version.CURRENT, null), new PersistentTasksCustomMetaData.Assignment("current-data-node-with-2-tasks", "")) - .addTask("data-frame-task-3", - Transform.NAME, - new Transform("data-frame-task-3", Version.CURRENT, null), + .addTask("transform-task-3", + TransformTaskParams.NAME, + new TransformTaskParams("transform-task-3", Version.CURRENT, null), new PersistentTasksCustomMetaData.Assignment("current-data-node-with-2-tasks", "")); PersistentTasksCustomMetaData pTasks = pTasksBuilder.build(); @@ -99,26 +99,26 @@ public void testNodeVersionAssignment() { ClusterState cs = csBuilder.build(); Client client = mock(Client.class); - DataFrameAuditor mockAuditor = mock(DataFrameAuditor.class); - DataFrameTransformsConfigManager transformsConfigManager = new DataFrameTransformsConfigManager(client, xContentRegistry()); - DataFrameTransformsCheckpointService dataFrameTransformsCheckpointService = new DataFrameTransformsCheckpointService(client, + TransformAuditor mockAuditor = mock(TransformAuditor.class); + TransformConfigManager transformsConfigManager = new TransformConfigManager(client, xContentRegistry()); + TransformCheckpointService transformCheckpointService = new TransformCheckpointService(client, transformsConfigManager, mockAuditor); ClusterSettings cSettings = new ClusterSettings(Settings.EMPTY, - Collections.singleton(DataFrameTransformTask.NUM_FAILURE_RETRIES_SETTING)); + Collections.singleton(TransformTask.NUM_FAILURE_RETRIES_SETTING)); ClusterService clusterService = mock(ClusterService.class); when(clusterService.getClusterSettings()).thenReturn(cSettings); - when(clusterService.state()).thenReturn(DataFrameInternalIndexTests.STATE_WITH_LATEST_VERSIONED_INDEX_TEMPLATE); - DataFrameTransformPersistentTasksExecutor executor = new DataFrameTransformPersistentTasksExecutor(client, + when(clusterService.state()).thenReturn(TransformInternalIndexTests.STATE_WITH_LATEST_VERSIONED_INDEX_TEMPLATE); + TransformPersistentTasksExecutor executor = new TransformPersistentTasksExecutor(client, transformsConfigManager, - dataFrameTransformsCheckpointService, mock(SchedulerEngine.class), - new DataFrameAuditor(client, ""), + transformCheckpointService, mock(SchedulerEngine.class), + new TransformAuditor(client, ""), mock(ThreadPool.class), clusterService, Settings.EMPTY); - assertThat(executor.getAssignment(new Transform("new-task-id", Version.CURRENT, null), cs).getExecutorNode(), + assertThat(executor.getAssignment(new TransformTaskParams("new-task-id", Version.CURRENT, null), cs).getExecutorNode(), equalTo("current-data-node-with-1-tasks")); - assertThat(executor.getAssignment(new Transform("new-old-task-id", Version.V_7_2_0, null), cs).getExecutorNode(), + assertThat(executor.getAssignment(new TransformTaskParams("new-old-task-id", Version.V_7_2_0, null), cs).getExecutorNode(), equalTo("past-data-node-1")); } @@ -132,11 +132,11 @@ public void testVerifyIndicesPrimaryShardsAreActive() { csBuilder.metaData(metaData); ClusterState cs = csBuilder.build(); - assertEquals(0, DataFrameTransformPersistentTasksExecutor.verifyIndicesPrimaryShardsAreActive(cs).size()); + assertEquals(0, TransformPersistentTasksExecutor.verifyIndicesPrimaryShardsAreActive(cs).size()); metaData = new MetaData.Builder(cs.metaData()); routingTable = new RoutingTable.Builder(cs.routingTable()); - String indexToRemove = DataFrameInternalIndex.LATEST_INDEX_NAME; + String indexToRemove = TransformInternalIndex.LATEST_INDEX_NAME; if (randomBoolean()) { routingTable.remove(indexToRemove); } else { @@ -151,15 +151,15 @@ public void testVerifyIndicesPrimaryShardsAreActive() { csBuilder.routingTable(routingTable.build()); csBuilder.metaData(metaData); - List result = DataFrameTransformPersistentTasksExecutor.verifyIndicesPrimaryShardsAreActive(csBuilder.build()); + List result = TransformPersistentTasksExecutor.verifyIndicesPrimaryShardsAreActive(csBuilder.build()); assertEquals(1, result.size()); assertEquals(indexToRemove, result.get(0)); } private void addIndices(MetaData.Builder metaData, RoutingTable.Builder routingTable) { List indices = new ArrayList<>(); - indices.add(DataFrameInternalIndex.AUDIT_INDEX); - indices.add(DataFrameInternalIndex.LATEST_INDEX_NAME); + indices.add(TransformInternalIndex.AUDIT_INDEX); + indices.add(TransformInternalIndex.LATEST_INDEX_NAME); for (String indexName : indices) { IndexMetaData.Builder indexMetaData = IndexMetaData.builder(indexName); indexMetaData.settings(Settings.builder()