From 586453fef10ec1a74853653dd7301227be3859a8 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Fri, 4 Jan 2019 09:43:44 +0200 Subject: [PATCH] [ML] Remove types from datafeed (#36538) Closes #34265 --- .../client/ml/datafeed/DatafeedConfig.java | 29 ++--------- .../client/ml/datafeed/DatafeedUpdate.java | 26 ++-------- .../client/MachineLearningIT.java | 3 -- .../MlClientDocumentationIT.java | 4 -- .../ml/datafeed/DatafeedConfigTests.java | 1 - .../ml/datafeed/DatafeedUpdateTests.java | 3 -- docs/reference/ml/aggregations.asciidoc | 1 - .../ml/apis/datafeedresource.asciidoc | 5 -- docs/reference/ml/apis/get-datafeed.asciidoc | 1 - docs/reference/ml/apis/put-datafeed.asciidoc | 6 --- .../ml/apis/update-datafeed.asciidoc | 6 --- docs/reference/ml/transforms.asciidoc | 4 -- .../core/ml/datafeed/DatafeedConfig.java | 44 +++++------------ .../core/ml/datafeed/DatafeedUpdate.java | 48 ++++++------------- .../persistence/ElasticsearchMappings.java | 3 -- .../ml/job/results/ReservedFieldNames.java | 1 - .../action/PutDatafeedActionRequestTests.java | 1 - .../PutDatafeedActionResponseTests.java | 1 - .../core/ml/datafeed/DatafeedConfigTests.java | 22 ++------- .../core/ml/datafeed/DatafeedUpdateTests.java | 28 ++--------- .../ml/integration/MlBasicMultiNodeIT.java | 1 - .../ml/integration/CategorizationIT.java | 2 - .../ml/integration/DatafeedJobsRestIT.java | 2 +- .../ml/integration/DeleteExpiredDataIT.java | 3 +- ...erimResultsDeletedAfterReopeningJobIT.java | 2 +- .../aggregation/AggregationDataExtractor.java | 5 +- .../AggregationDataExtractorContext.java | 6 +-- .../AggregationDataExtractorFactory.java | 1 - .../RollupDataExtractorFactory.java | 1 - .../chunked/ChunkedDataExtractor.java | 2 +- .../chunked/ChunkedDataExtractorContext.java | 9 ++-- .../chunked/ChunkedDataExtractorFactory.java | 1 - .../extractor/scroll/ScrollDataExtractor.java | 1 - .../scroll/ScrollDataExtractorContext.java | 8 ++-- .../scroll/ScrollDataExtractorFactory.java | 1 - .../xpack/ml/MlMetadataTests.java | 1 - .../datafeed/DatafeedJobValidatorTests.java | 1 - .../ml/datafeed/DatafeedManagerTests.java | 1 - .../DelayedDataDetectorFactoryTests.java | 1 - .../AggregationDataExtractorTests.java | 4 +- .../chunked/ChunkedDataExtractorTests.java | 4 +- .../fields/TimeBasedExtractedFieldsTests.java | 4 -- .../scroll/ScrollDataExtractorTests.java | 6 +-- .../xpack/ml/support/BaseMlIntegTestCase.java | 1 - .../rest-api-spec/test/ml/datafeeds_crud.yml | 39 ++++----------- .../test/ml/delete_job_force.yml | 3 +- .../test/ml/get_datafeed_stats.yml | 6 +-- .../rest-api-spec/test/ml/get_datafeeds.yml | 6 +-- .../rest-api-spec/test/ml/jobs_crud.yml | 3 +- .../rest-api-spec/test/ml/jobs_get_stats.yml | 3 +- .../test/ml/preview_datafeed.yml | 10 +--- .../test/ml/start_stop_datafeed.yml | 15 ++---- .../mixed_cluster/40_ml_datafeed_crud.yml | 2 - .../upgraded_cluster/40_ml_datafeed_crud.yml | 2 - .../xpack/ml/client/MLTransportClientIT.java | 1 - 55 files changed, 89 insertions(+), 306 deletions(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/datafeed/DatafeedConfig.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/datafeed/DatafeedConfig.java index b5bd1367beb..f56da88303d 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/datafeed/DatafeedConfig.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/datafeed/DatafeedConfig.java @@ -56,7 +56,6 @@ public class DatafeedConfig implements ToXContentObject { public static final ParseField FREQUENCY = new ParseField("frequency"); public static final ParseField INDEXES = new ParseField("indexes"); public static final ParseField INDICES = new ParseField("indices"); - public static final ParseField TYPES = new ParseField("types"); public static final ParseField QUERY = new ParseField("query"); public static final ParseField SCROLL_SIZE = new ParseField("scroll_size"); public static final ParseField AGGREGATIONS = new ParseField("aggregations"); @@ -73,7 +72,6 @@ public class DatafeedConfig implements ToXContentObject { PARSER.declareStringArray(Builder::setIndices, INDEXES); PARSER.declareStringArray(Builder::setIndices, INDICES); - PARSER.declareStringArray(Builder::setTypes, TYPES); PARSER.declareString((builder, val) -> builder.setQueryDelay(TimeValue.parseTimeValue(val, QUERY_DELAY.getPreferredName())), QUERY_DELAY); PARSER.declareString((builder, val) -> @@ -103,7 +101,6 @@ public class DatafeedConfig implements ToXContentObject { private final TimeValue queryDelay; private final TimeValue frequency; private final List indices; - private final List types; private final BytesReference query; private final BytesReference aggregations; private final List scriptFields; @@ -112,15 +109,14 @@ public class DatafeedConfig implements ToXContentObject { private final DelayedDataCheckConfig delayedDataCheckConfig; - private DatafeedConfig(String id, String jobId, TimeValue queryDelay, TimeValue frequency, List indices, List types, - BytesReference query, BytesReference aggregations, List scriptFields, - Integer scrollSize, ChunkingConfig chunkingConfig, DelayedDataCheckConfig delayedDataCheckConfig) { + private DatafeedConfig(String id, String jobId, TimeValue queryDelay, TimeValue frequency, List indices, BytesReference query, + BytesReference aggregations, List scriptFields, Integer scrollSize, + ChunkingConfig chunkingConfig, DelayedDataCheckConfig delayedDataCheckConfig) { this.id = id; this.jobId = jobId; this.queryDelay = queryDelay; this.frequency = frequency; this.indices = indices == null ? null : Collections.unmodifiableList(indices); - this.types = types == null ? null : Collections.unmodifiableList(types); this.query = query; this.aggregations = aggregations; this.scriptFields = scriptFields == null ? null : Collections.unmodifiableList(scriptFields); @@ -149,10 +145,6 @@ public class DatafeedConfig implements ToXContentObject { return indices; } - public List getTypes() { - return types; - } - public Integer getScrollSize() { return scrollSize; } @@ -191,9 +183,6 @@ public class DatafeedConfig implements ToXContentObject { if (indices != null) { builder.field(INDICES.getPreferredName(), indices); } - if (types != null) { - builder.field(TYPES.getPreferredName(), types); - } if (query != null) { builder.field(QUERY.getPreferredName(), asMap(query)); } @@ -251,7 +240,6 @@ public class DatafeedConfig implements ToXContentObject { && Objects.equals(this.frequency, that.frequency) && Objects.equals(this.queryDelay, that.queryDelay) && Objects.equals(this.indices, that.indices) - && Objects.equals(this.types, that.types) && Objects.equals(asMap(this.query), asMap(that.query)) && Objects.equals(this.scrollSize, that.scrollSize) && Objects.equals(asMap(this.aggregations), asMap(that.aggregations)) @@ -267,7 +255,7 @@ public class DatafeedConfig implements ToXContentObject { */ @Override public int hashCode() { - return Objects.hash(id, jobId, frequency, queryDelay, indices, types, asMap(query), scrollSize, asMap(aggregations), scriptFields, + return Objects.hash(id, jobId, frequency, queryDelay, indices, asMap(query), scrollSize, asMap(aggregations), scriptFields, chunkingConfig, delayedDataCheckConfig); } @@ -282,7 +270,6 @@ public class DatafeedConfig implements ToXContentObject { private TimeValue queryDelay; private TimeValue frequency; private List indices; - private List types; private BytesReference query; private BytesReference aggregations; private List scriptFields; @@ -301,7 +288,6 @@ public class DatafeedConfig implements ToXContentObject { this.queryDelay = config.queryDelay; this.frequency = config.frequency; this.indices = config.indices == null ? null : new ArrayList<>(config.indices); - this.types = config.types == null ? null : new ArrayList<>(config.types); this.query = config.query; this.aggregations = config.aggregations; this.scriptFields = config.scriptFields == null ? null : new ArrayList<>(config.scriptFields); @@ -319,11 +305,6 @@ public class DatafeedConfig implements ToXContentObject { return setIndices(Arrays.asList(indices)); } - public Builder setTypes(List types) { - this.types = types; - return this; - } - public Builder setQueryDelay(TimeValue queryDelay) { this.queryDelay = queryDelay; return this; @@ -396,7 +377,7 @@ public class DatafeedConfig implements ToXContentObject { } public DatafeedConfig build() { - return new DatafeedConfig(id, jobId, queryDelay, frequency, indices, types, query, aggregations, scriptFields, scrollSize, + return new DatafeedConfig(id, jobId, queryDelay, frequency, indices, query, aggregations, scriptFields, scrollSize, chunkingConfig, delayedDataCheckConfig); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/datafeed/DatafeedUpdate.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/datafeed/DatafeedUpdate.java index 5daacdd9a05..15598de91d4 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/datafeed/DatafeedUpdate.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/datafeed/DatafeedUpdate.java @@ -60,7 +60,6 @@ public class DatafeedUpdate implements ToXContentObject { PARSER.declareString(Builder::setJobId, Job.ID); PARSER.declareStringArray(Builder::setIndices, DatafeedConfig.INDEXES); PARSER.declareStringArray(Builder::setIndices, DatafeedConfig.INDICES); - PARSER.declareStringArray(Builder::setTypes, DatafeedConfig.TYPES); PARSER.declareString((builder, val) -> builder.setQueryDelay( TimeValue.parseTimeValue(val, DatafeedConfig.QUERY_DELAY.getPreferredName())), DatafeedConfig.QUERY_DELAY); PARSER.declareString((builder, val) -> builder.setFrequency( @@ -93,7 +92,6 @@ public class DatafeedUpdate implements ToXContentObject { private final TimeValue queryDelay; private final TimeValue frequency; private final List indices; - private final List types; private final BytesReference query; private final BytesReference aggregations; private final List scriptFields; @@ -101,15 +99,14 @@ public class DatafeedUpdate implements ToXContentObject { private final ChunkingConfig chunkingConfig; private final DelayedDataCheckConfig delayedDataCheckConfig; - private DatafeedUpdate(String id, String jobId, TimeValue queryDelay, TimeValue frequency, List indices, List types, - BytesReference query, BytesReference aggregations, List scriptFields, - Integer scrollSize, ChunkingConfig chunkingConfig, DelayedDataCheckConfig delayedDataCheckConfig) { + private DatafeedUpdate(String id, String jobId, TimeValue queryDelay, TimeValue frequency, List indices, BytesReference query, + BytesReference aggregations, List scriptFields, Integer scrollSize, + ChunkingConfig chunkingConfig, DelayedDataCheckConfig delayedDataCheckConfig) { this.id = id; this.jobId = jobId; this.queryDelay = queryDelay; this.frequency = frequency; this.indices = indices; - this.types = types; this.query = query; this.aggregations = aggregations; this.scriptFields = scriptFields; @@ -143,7 +140,6 @@ public class DatafeedUpdate implements ToXContentObject { if (aggregations != null) { builder.field(DatafeedConfig.AGGREGATIONS.getPreferredName(), asMap(aggregations)); } - addOptionalField(builder, DatafeedConfig.TYPES, types); if (scriptFields != null) { builder.startObject(DatafeedConfig.SCRIPT_FIELDS.getPreferredName()); for (SearchSourceBuilder.ScriptField scriptField : scriptFields) { @@ -182,10 +178,6 @@ public class DatafeedUpdate implements ToXContentObject { return indices; } - public List getTypes() { - return types; - } - public Integer getScrollSize() { return scrollSize; } @@ -240,7 +232,6 @@ public class DatafeedUpdate implements ToXContentObject { && Objects.equals(this.frequency, that.frequency) && Objects.equals(this.queryDelay, that.queryDelay) && Objects.equals(this.indices, that.indices) - && Objects.equals(this.types, that.types) && Objects.equals(asMap(this.query), asMap(that.query)) && Objects.equals(this.scrollSize, that.scrollSize) && Objects.equals(asMap(this.aggregations), asMap(that.aggregations)) @@ -256,7 +247,7 @@ public class DatafeedUpdate implements ToXContentObject { */ @Override public int hashCode() { - return Objects.hash(id, jobId, frequency, queryDelay, indices, types, asMap(query), scrollSize, asMap(aggregations), scriptFields, + return Objects.hash(id, jobId, frequency, queryDelay, indices, asMap(query), scrollSize, asMap(aggregations), scriptFields, chunkingConfig, delayedDataCheckConfig); } @@ -271,7 +262,6 @@ public class DatafeedUpdate implements ToXContentObject { private TimeValue queryDelay; private TimeValue frequency; private List indices; - private List types; private BytesReference query; private BytesReference aggregations; private List scriptFields; @@ -289,7 +279,6 @@ public class DatafeedUpdate implements ToXContentObject { this.queryDelay = config.queryDelay; this.frequency = config.frequency; this.indices = config.indices; - this.types = config.types; this.query = config.query; this.aggregations = config.aggregations; this.scriptFields = config.scriptFields; @@ -312,11 +301,6 @@ public class DatafeedUpdate implements ToXContentObject { return setIndices(Arrays.asList(indices)); } - public Builder setTypes(List types) { - this.types = types; - return this; - } - public Builder setQueryDelay(TimeValue queryDelay) { this.queryDelay = queryDelay; return this; @@ -380,7 +364,7 @@ public class DatafeedUpdate implements ToXContentObject { } public DatafeedUpdate build() { - return new DatafeedUpdate(id, jobId, queryDelay, frequency, indices, types, query, aggregations, scriptFields, scrollSize, + return new DatafeedUpdate(id, jobId, queryDelay, frequency, indices, query, aggregations, scriptFields, scrollSize, chunkingConfig, delayedDataCheckConfig); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/MachineLearningIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/MachineLearningIT.java index 841b5399bfb..4f009e53450 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/MachineLearningIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/MachineLearningIT.java @@ -558,7 +558,6 @@ public class MachineLearningIT extends ESRestHighLevelClientTestCase { DatafeedConfig datafeed = DatafeedConfig.builder(datafeedId, jobId) .setIndices(indexName) .setQueryDelay(TimeValue.timeValueSeconds(1)) - .setTypes(Arrays.asList("_doc")) .setFrequency(TimeValue.timeValueSeconds(1)).build(); machineLearningClient.putDatafeed(new PutDatafeedRequest(datafeed), RequestOptions.DEFAULT); @@ -768,7 +767,6 @@ public class MachineLearningIT extends ESRestHighLevelClientTestCase { DatafeedConfig datafeed = DatafeedConfig.builder(datafeedId, jobId) .setIndices(indexName) .setQueryDelay(TimeValue.timeValueSeconds(1)) - .setTypes(Collections.singletonList("_doc")) .setFrequency(TimeValue.timeValueSeconds(1)).build(); machineLearningClient.putDatafeed(new PutDatafeedRequest(datafeed), RequestOptions.DEFAULT); @@ -1403,7 +1401,6 @@ public class MachineLearningIT extends ESRestHighLevelClientTestCase { DatafeedConfig datafeed = DatafeedConfig.builder(datafeedId, jobId) .setIndices(indexName) .setQueryDelay(TimeValue.timeValueSeconds(1)) - .setTypes(Arrays.asList("_doc")) .setFrequency(TimeValue.timeValueSeconds(1)).build(); highLevelClient().machineLearning().putDatafeed(new PutDatafeedRequest(datafeed), RequestOptions.DEFAULT); return datafeedId; diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MlClientDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MlClientDocumentationIT.java index 5a4df9ecff4..eb74421c7a1 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MlClientDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MlClientDocumentationIT.java @@ -872,7 +872,6 @@ public class MlClientDocumentationIT extends ESRestHighLevelClientTestCase { createIndexRequest.mapping("_doc", "timestamp", "type=date", "total", "type=long"); highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT); DatafeedConfig datafeed = DatafeedConfig.builder(datafeedId, job.getId()) - .setTypes(Arrays.asList("_doc")) .setIndices(indexName) .build(); client.machineLearning().putDatafeed(new PutDatafeedRequest(datafeed), RequestOptions.DEFAULT); @@ -932,7 +931,6 @@ public class MlClientDocumentationIT extends ESRestHighLevelClientTestCase { createIndexRequest.mapping("_doc", "timestamp", "type=date", "total", "type=long"); highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT); DatafeedConfig datafeed = DatafeedConfig.builder(datafeedId, job.getId()) - .setTypes(Arrays.asList("_doc")) .setIndices(indexName) .build(); client.machineLearning().putDatafeed(new PutDatafeedRequest(datafeed), RequestOptions.DEFAULT); @@ -1053,14 +1051,12 @@ public class MlClientDocumentationIT extends ESRestHighLevelClientTestCase { createIndexRequest.mapping("_doc", "timestamp", "type=date", "total", "type=long"); highLevelClient().indices().create(createIndexRequest, RequestOptions.DEFAULT); DatafeedConfig datafeed = DatafeedConfig.builder(datafeedId1, job.getId()) - .setTypes(Arrays.asList("_doc")) .setIndices(indexName) .build(); client.machineLearning().putDatafeed(new PutDatafeedRequest(datafeed), RequestOptions.DEFAULT); String datafeedId2 = secondJob.getId() + "-feed"; DatafeedConfig secondDatafeed = DatafeedConfig.builder(datafeedId2, secondJob.getId()) - .setTypes(Arrays.asList("_doc")) .setIndices(indexName) .build(); client.machineLearning().putDatafeed(new PutDatafeedRequest(secondDatafeed), RequestOptions.DEFAULT); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/datafeed/DatafeedConfigTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/datafeed/DatafeedConfigTests.java index c7fb1c80388..0b0ed52d0ff 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/datafeed/DatafeedConfigTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/datafeed/DatafeedConfigTests.java @@ -51,7 +51,6 @@ public class DatafeedConfigTests extends AbstractXContentTestCase>. - `delayed_data_check_config`:: (object) Specifies whether the data feed checks for missing data and and the size of the window. For example: diff --git a/docs/reference/ml/apis/get-datafeed.asciidoc b/docs/reference/ml/apis/get-datafeed.asciidoc index 437a56b86df..b54eb59bb7a 100644 --- a/docs/reference/ml/apis/get-datafeed.asciidoc +++ b/docs/reference/ml/apis/get-datafeed.asciidoc @@ -76,7 +76,6 @@ The API returns the following results: "indices": [ "server-metrics" ], - "types": [], "query": { "match_all": { "boost": 1.0 diff --git a/docs/reference/ml/apis/put-datafeed.asciidoc b/docs/reference/ml/apis/put-datafeed.asciidoc index 791a51486c8..d2c935ba6d3 100644 --- a/docs/reference/ml/apis/put-datafeed.asciidoc +++ b/docs/reference/ml/apis/put-datafeed.asciidoc @@ -73,11 +73,6 @@ You must create a job before you create a {dfeed}. You can associate only one (unsigned integer) The `size` parameter that is used in {es} searches. The default value is `1000`. -`types`:: - (array) A list of types to search for within the specified indices. - For example: `[]`. This property is provided for backwards compatibility with - releases earlier than 6.0.0. For more information, see <>. - `delayed_data_check_config`:: (object) Specifies if and with how large a window should the data feed check for missing data. See <>. @@ -125,7 +120,6 @@ When the {dfeed} is created, you receive the following results: "indices": [ "server-metrics" ], - "types": [], "query": { "match_all": { "boost": 1.0 diff --git a/docs/reference/ml/apis/update-datafeed.asciidoc b/docs/reference/ml/apis/update-datafeed.asciidoc index 37b489e6ef5..1e888f823ff 100644 --- a/docs/reference/ml/apis/update-datafeed.asciidoc +++ b/docs/reference/ml/apis/update-datafeed.asciidoc @@ -68,11 +68,6 @@ The following properties can be updated after the {dfeed} is created: (unsigned integer) The `size` parameter that is used in {es} searches. The default value is `1000`. -`types`:: - (array) A list of types to search for within the specified indices. - For example: `[]`. This property is provided for backwards compatibility with - releases earlier than 6.0.0. For more information, see <>. - For more information about these properties, see <>. @@ -120,7 +115,6 @@ with the updated values: "job_id": "total-requests", "query_delay": "83474ms", "indices": ["server-metrics"], - "types": [], "query": { "term": { "level": { diff --git a/docs/reference/ml/transforms.asciidoc b/docs/reference/ml/transforms.asciidoc index 566f3685513..66c55d72b14 100644 --- a/docs/reference/ml/transforms.asciidoc +++ b/docs/reference/ml/transforms.asciidoc @@ -127,7 +127,6 @@ PUT _ml/datafeeds/datafeed-test1 { "job_id": "test1", "indices": ["my_index"], - "types": ["_doc"], "query": { "match_all": { "boost": 1 @@ -233,7 +232,6 @@ PUT _ml/datafeeds/datafeed-test2 { "job_id": "test2", "indices": ["my_index"], - "types": ["_doc"], "query": { "match_all": { "boost": 1 @@ -482,7 +480,6 @@ PUT _ml/datafeeds/datafeed-test3 { "job_id": "test3", "indices": ["my_index"], - "types": ["_doc"], "query": { "match_all": { "boost": 1 @@ -551,7 +548,6 @@ PUT _ml/datafeeds/datafeed-test4 { "job_id": "test4", "indices": ["my_index"], - "types": ["_doc"], "query": { "match_all": { "boost": 1 diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java index 02f76c54a27..3002a43e9d8 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java @@ -124,7 +124,6 @@ public class DatafeedConfig extends AbstractDiffable implements public static final ParseField FREQUENCY = new ParseField("frequency"); public static final ParseField INDEXES = new ParseField("indexes"); public static final ParseField INDICES = new ParseField("indices"); - public static final ParseField TYPES = new ParseField("types"); public static final ParseField QUERY = new ParseField("query"); public static final ParseField SCROLL_SIZE = new ParseField("scroll_size"); public static final ParseField AGGREGATIONS = new ParseField("aggregations"); @@ -161,7 +160,6 @@ public class DatafeedConfig extends AbstractDiffable implements parser.declareString(Builder::setJobId, Job.ID); parser.declareStringArray(Builder::setIndices, INDEXES); parser.declareStringArray(Builder::setIndices, INDICES); - parser.declareStringArray(Builder::setTypes, TYPES); parser.declareString((builder, val) -> builder.setQueryDelay(TimeValue.parseTimeValue(val, QUERY_DELAY.getPreferredName())), QUERY_DELAY); parser.declareString((builder, val) -> @@ -212,7 +210,6 @@ public class DatafeedConfig extends AbstractDiffable implements private final TimeValue frequency; private final List indices; - private final List types; private final Map query; private final Map aggregations; private final List scriptFields; @@ -223,7 +220,7 @@ public class DatafeedConfig extends AbstractDiffable implements private final CachedSupplier querySupplier; private final CachedSupplier aggSupplier; - private DatafeedConfig(String id, String jobId, TimeValue queryDelay, TimeValue frequency, List indices, List types, + private DatafeedConfig(String id, String jobId, TimeValue queryDelay, TimeValue frequency, List indices, Map query, Map aggregations, List scriptFields, Integer scrollSize, ChunkingConfig chunkingConfig, Map headers, DelayedDataCheckConfig delayedDataCheckConfig) { @@ -232,7 +229,6 @@ public class DatafeedConfig extends AbstractDiffable implements this.queryDelay = queryDelay; this.frequency = frequency; this.indices = indices == null ? null : Collections.unmodifiableList(indices); - this.types = types == null ? null : Collections.unmodifiableList(types); this.query = query == null ? null : Collections.unmodifiableMap(query); this.aggregations = aggregations == null ? null : Collections.unmodifiableMap(aggregations); this.scriptFields = scriptFields == null ? null : Collections.unmodifiableList(scriptFields); @@ -254,10 +250,11 @@ public class DatafeedConfig extends AbstractDiffable implements } else { this.indices = null; } - if (in.readBoolean()) { - this.types = Collections.unmodifiableList(in.readList(StreamInput::readString)); - } else { - this.types = null; + // This consumes the list of types if there was one. + if (in.getVersion().before(Version.V_7_0_0)) { + if (in.readBoolean()) { + in.readList(StreamInput::readString); + } } if (in.getVersion().before(Version.V_6_6_0)) { this.query = QUERY_TRANSFORMER.toMap(in.readNamedWriteable(QueryBuilder.class)); @@ -325,10 +322,6 @@ public class DatafeedConfig extends AbstractDiffable implements return indices; } - public List getTypes() { - return types; - } - public Integer getScrollSize() { return scrollSize; } @@ -419,11 +412,11 @@ public class DatafeedConfig extends AbstractDiffable implements } else { out.writeBoolean(false); } - if (types != null) { + // Write the now removed types to prior versions. + // An empty list is expected + if (out.getVersion().before(Version.V_7_0_0)) { out.writeBoolean(true); - out.writeStringList(types); - } else { - out.writeBoolean(false); + out.writeStringList(Collections.emptyList()); } if (out.getVersion().before(Version.V_6_6_0)) { out.writeNamedWriteable(getParsedQuery()); @@ -464,7 +457,6 @@ public class DatafeedConfig extends AbstractDiffable implements builder.field(FREQUENCY.getPreferredName(), frequency.getStringRep()); } builder.field(INDICES.getPreferredName(), indices); - builder.field(TYPES.getPreferredName(), types); builder.field(QUERY.getPreferredName(), query); if (aggregations != null) { builder.field(AGGREGATIONS.getPreferredName(), aggregations); @@ -512,7 +504,6 @@ public class DatafeedConfig extends AbstractDiffable implements && Objects.equals(this.frequency, that.frequency) && Objects.equals(this.queryDelay, that.queryDelay) && Objects.equals(this.indices, that.indices) - && Objects.equals(this.types, that.types) && Objects.equals(this.query, that.query) && Objects.equals(this.scrollSize, that.scrollSize) && Objects.equals(this.aggregations, that.aggregations) @@ -524,8 +515,8 @@ public class DatafeedConfig extends AbstractDiffable implements @Override public int hashCode() { - return Objects.hash(id, jobId, frequency, queryDelay, indices, types, query, scrollSize, aggregations, scriptFields, - chunkingConfig, headers, delayedDataCheckConfig); + return Objects.hash(id, jobId, frequency, queryDelay, indices, query, scrollSize, aggregations, scriptFields, chunkingConfig, + headers, delayedDataCheckConfig); } @Override @@ -591,7 +582,6 @@ public class DatafeedConfig extends AbstractDiffable implements private TimeValue queryDelay; private TimeValue frequency; private List indices = Collections.emptyList(); - private List types = Collections.emptyList(); private Map query; private Map aggregations; private List scriptFields; @@ -618,7 +608,6 @@ public class DatafeedConfig extends AbstractDiffable implements this.queryDelay = config.queryDelay; this.frequency = config.frequency; this.indices = new ArrayList<>(config.indices); - this.types = new ArrayList<>(config.types); this.query = config.query == null ? null : new LinkedHashMap<>(config.query); this.aggregations = config.aggregations == null ? null : new LinkedHashMap<>(config.aggregations); this.scriptFields = config.scriptFields == null ? null : new ArrayList<>(config.scriptFields); @@ -648,10 +637,6 @@ public class DatafeedConfig extends AbstractDiffable implements this.indices = ExceptionsHelper.requireNonNull(indices, INDICES.getPreferredName()); } - public void setTypes(List types) { - this.types = ExceptionsHelper.requireNonNull(types, TYPES.getPreferredName()); - } - public void setQueryDelay(TimeValue queryDelay) { TimeUtils.checkNonNegativeMultiple(queryDelay, TimeUnit.MILLISECONDS, QUERY_DELAY); this.queryDelay = queryDelay; @@ -741,15 +726,12 @@ public class DatafeedConfig extends AbstractDiffable implements if (indices == null || indices.isEmpty() || indices.contains(null) || indices.contains("")) { throw invalidOptionValue(INDICES.getPreferredName(), indices); } - if (types == null || types.contains(null) || types.contains("")) { - throw invalidOptionValue(TYPES.getPreferredName(), types); - } validateScriptFields(); setDefaultChunkingConfig(); setDefaultQueryDelay(); - return new DatafeedConfig(id, jobId, queryDelay, frequency, indices, types, query, aggregations, scriptFields, scrollSize, + return new DatafeedConfig(id, jobId, queryDelay, frequency, indices, query, aggregations, scriptFields, scrollSize, chunkingConfig, headers, delayedDataCheckConfig); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdate.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdate.java index 62cce599735..8bc49d4598a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdate.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdate.java @@ -48,7 +48,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { PARSER.declareString(Builder::setJobId, Job.ID); PARSER.declareStringArray(Builder::setIndices, DatafeedConfig.INDEXES); PARSER.declareStringArray(Builder::setIndices, DatafeedConfig.INDICES); - PARSER.declareStringArray(Builder::setTypes, DatafeedConfig.TYPES); PARSER.declareString((builder, val) -> builder.setQueryDelay( TimeValue.parseTimeValue(val, DatafeedConfig.QUERY_DELAY.getPreferredName())), DatafeedConfig.QUERY_DELAY); PARSER.declareString((builder, val) -> builder.setFrequency( @@ -79,7 +78,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { private final TimeValue queryDelay; private final TimeValue frequency; private final List indices; - private final List types; private final QueryBuilder query; private final AggregatorFactories.Builder aggregations; private final List scriptFields; @@ -87,15 +85,14 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { private final ChunkingConfig chunkingConfig; private final DelayedDataCheckConfig delayedDataCheckConfig; - private DatafeedUpdate(String id, String jobId, TimeValue queryDelay, TimeValue frequency, List indices, List types, - QueryBuilder query, AggregatorFactories.Builder aggregations, List scriptFields, - Integer scrollSize, ChunkingConfig chunkingConfig, DelayedDataCheckConfig delayedDataCheckConfig) { + private DatafeedUpdate(String id, String jobId, TimeValue queryDelay, TimeValue frequency, List indices, QueryBuilder query, + AggregatorFactories.Builder aggregations, List scriptFields, Integer scrollSize, + ChunkingConfig chunkingConfig, DelayedDataCheckConfig delayedDataCheckConfig) { this.id = id; this.jobId = jobId; this.queryDelay = queryDelay; this.frequency = frequency; this.indices = indices; - this.types = types; this.query = query; this.aggregations = aggregations; this.scriptFields = scriptFields; @@ -114,10 +111,11 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { } else { this.indices = null; } - if (in.readBoolean()) { - this.types = in.readList(StreamInput::readString); - } else { - this.types = null; + // This consumes the list of types if there was one. + if (in.getVersion().before(Version.V_7_0_0)) { + if (in.readBoolean()) { + in.readList(StreamInput::readString); + } } this.query = in.readOptionalNamedWriteable(QueryBuilder.class); this.aggregations = in.readOptionalWriteable(AggregatorFactories.Builder::new); @@ -154,11 +152,11 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { } else { out.writeBoolean(false); } - if (types != null) { + // Write the now removed types to prior versions. + // An empty list is expected + if (out.getVersion().before(Version.V_7_0_0)) { out.writeBoolean(true); - out.writeStringList(types); - } else { - out.writeBoolean(false); + out.writeStringList(Collections.emptyList()); } out.writeOptionalNamedWriteable(query); out.writeOptionalWriteable(aggregations); @@ -187,7 +185,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { builder.field(DatafeedConfig.FREQUENCY.getPreferredName(), frequency.getStringRep()); } addOptionalField(builder, DatafeedConfig.INDICES, indices); - addOptionalField(builder, DatafeedConfig.TYPES, types); addOptionalField(builder, DatafeedConfig.QUERY, query); addOptionalField(builder, DatafeedConfig.AGGREGATIONS, aggregations); if (scriptFields != null) { @@ -226,10 +223,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { return indices; } - List getTypes() { - return types; - } - Integer getScrollSize() { return scrollSize; } @@ -291,9 +284,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { if (indices != null) { builder.setIndices(indices); } - if (types != null) { - builder.setTypes(types); - } if (query != null) { builder.setParsedQuery(query); } @@ -347,7 +337,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { && Objects.equals(this.frequency, that.frequency) && Objects.equals(this.queryDelay, that.queryDelay) && Objects.equals(this.indices, that.indices) - && Objects.equals(this.types, that.types) && Objects.equals(this.query, that.query) && Objects.equals(this.scrollSize, that.scrollSize) && Objects.equals(this.aggregations, that.aggregations) @@ -358,8 +347,8 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { @Override public int hashCode() { - return Objects.hash(id, jobId, frequency, queryDelay, indices, types, query, scrollSize, aggregations, scriptFields, - chunkingConfig, delayedDataCheckConfig); + return Objects.hash(id, jobId, frequency, queryDelay, indices, query, scrollSize, aggregations, scriptFields, chunkingConfig, + delayedDataCheckConfig); } @Override @@ -371,7 +360,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { return (frequency == null || Objects.equals(frequency, datafeed.getFrequency())) && (queryDelay == null || Objects.equals(queryDelay, datafeed.getQueryDelay())) && (indices == null || Objects.equals(indices, datafeed.getIndices())) - && (types == null || Objects.equals(types, datafeed.getTypes())) && (query == null || Objects.equals(query, datafeed.getParsedQuery())) && (scrollSize == null || Objects.equals(scrollSize, datafeed.getQueryDelay())) && (aggregations == null || Objects.equals(aggregations, datafeed.getParsedAggregations())) @@ -387,7 +375,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { private TimeValue queryDelay; private TimeValue frequency; private List indices; - private List types; private QueryBuilder query; private AggregatorFactories.Builder aggregations; private List scriptFields; @@ -408,7 +395,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { this.queryDelay = config.queryDelay; this.frequency = config.frequency; this.indices = config.indices; - this.types = config.types; this.query = config.query; this.aggregations = config.aggregations; this.scriptFields = config.scriptFields; @@ -429,10 +415,6 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { this.indices = indices; } - public void setTypes(List types) { - this.types = types; - } - public void setQueryDelay(TimeValue queryDelay) { this.queryDelay = queryDelay; } @@ -468,7 +450,7 @@ public class DatafeedUpdate implements Writeable, ToXContentObject { } public DatafeedUpdate build() { - return new DatafeedUpdate(id, jobId, queryDelay, frequency, indices, types, query, aggregations, scriptFields, scrollSize, + return new DatafeedUpdate(id, jobId, queryDelay, frequency, indices, query, aggregations, scriptFields, scrollSize, chunkingConfig, delayedDataCheckConfig); } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/persistence/ElasticsearchMappings.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/persistence/ElasticsearchMappings.java index 0ed8c9f08b8..fb0db771fa5 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/persistence/ElasticsearchMappings.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/persistence/ElasticsearchMappings.java @@ -325,9 +325,6 @@ public class ElasticsearchMappings { .startObject(DatafeedConfig.INDICES.getPreferredName()) .field(TYPE, KEYWORD) .endObject() - .startObject(DatafeedConfig.TYPES.getPreferredName()) - .field(TYPE, KEYWORD) - .endObject() .startObject(DatafeedConfig.QUERY.getPreferredName()) .field(ENABLED, false) .endObject() diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/results/ReservedFieldNames.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/results/ReservedFieldNames.java index f6b90b69ea6..333b87b0c29 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/results/ReservedFieldNames.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/results/ReservedFieldNames.java @@ -243,7 +243,6 @@ public final class ReservedFieldNames { DatafeedConfig.QUERY_DELAY.getPreferredName(), DatafeedConfig.FREQUENCY.getPreferredName(), DatafeedConfig.INDICES.getPreferredName(), - DatafeedConfig.TYPES.getPreferredName(), DatafeedConfig.QUERY.getPreferredName(), DatafeedConfig.SCROLL_SIZE.getPreferredName(), DatafeedConfig.AGGREGATIONS.getPreferredName(), diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutDatafeedActionRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutDatafeedActionRequestTests.java index f01a360f909..d688ee9b5b9 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutDatafeedActionRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutDatafeedActionRequestTests.java @@ -31,7 +31,6 @@ public class PutDatafeedActionRequestTests extends AbstractStreamableXContentTes protected Request createTestInstance() { DatafeedConfig.Builder datafeedConfig = new DatafeedConfig.Builder(datafeedId, randomAlphaOfLength(10)); datafeedConfig.setIndices(Collections.singletonList(randomAlphaOfLength(10))); - datafeedConfig.setTypes(Collections.singletonList(randomAlphaOfLength(10))); return new Request(datafeedConfig.build()); } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutDatafeedActionResponseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutDatafeedActionResponseTests.java index 13e00e27f68..ca650914fe1 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutDatafeedActionResponseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/PutDatafeedActionResponseTests.java @@ -23,7 +23,6 @@ public class PutDatafeedActionResponseTests extends AbstractStreamableTestCase types = new ArrayList<>(instance.getTypes()); - types.add(randomAlphaOfLengthBetween(1, 20)); - builder.setTypes(types); - break; - case 6: BoolQueryBuilder query = new BoolQueryBuilder(); if (instance.getParsedQuery() != null) { query.must(instance.getParsedQuery()); @@ -819,7 +807,7 @@ public class DatafeedConfigTests extends AbstractSerializingTestCase scriptFields = new ArrayList<>(instance.getScriptFields()); scriptFields.add(new ScriptField(randomAlphaOfLengthBetween(1, 10), new Script("foo"), true)); builder.setScriptFields(scriptFields); builder.setAggregations(null); break; - case 9: + case 8: builder.setScrollSize(instance.getScrollSize() + between(1, 100)); break; - case 10: + case 9: if (instance.getChunkingConfig() == null || instance.getChunkingConfig().getMode() == Mode.AUTO) { ChunkingConfig newChunkingConfig = ChunkingConfig.newManual(new TimeValue(randomNonNegativeLong())); builder.setChunkingConfig(newChunkingConfig); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdateTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdateTests.java index bf61ed541ae..302bfefc7c4 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdateTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdateTests.java @@ -60,9 +60,6 @@ public class DatafeedUpdateTests extends AbstractSerializingTestCase types; - if (instance.getTypes() == null) { - types = new ArrayList<>(); - } else { - types = new ArrayList<>(instance.getTypes()); - } - types.add(randomAlphaOfLengthBetween(1, 20)); - builder.setTypes(types); - break; - case 6: BoolQueryBuilder query = new BoolQueryBuilder(); if (instance.getQuery() != null) { query.must(instance.getQuery()); @@ -268,7 +250,7 @@ public class DatafeedUpdateTests extends AbstractSerializingTestCase scriptFields = new ArrayList<>(instance.getScriptFields()); scriptFields.add(new ScriptField(randomAlphaOfLengthBetween(1, 10), new Script("foo"), true)); builder.setScriptFields(scriptFields); builder.setAggregations(null); break; - case 9: + case 8: if (instance.getScrollSize() == null) { builder.setScrollSize(between(1, 100)); } else { builder.setScrollSize(instance.getScrollSize() + between(1, 100)); } break; - case 10: + case 9: if (instance.getChunkingConfig() == null || instance.getChunkingConfig().getMode() == Mode.AUTO) { ChunkingConfig newChunkingConfig = ChunkingConfig.newManual(new TimeValue(randomNonNegativeLong())); builder.setChunkingConfig(newChunkingConfig); diff --git a/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java b/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java index 4d3ec8e2b24..0cfa6f5ebf0 100644 --- a/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java +++ b/x-pack/plugin/ml/qa/basic-multi-node/src/test/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java @@ -265,7 +265,6 @@ public class MlBasicMultiNodeIT extends ESRestTestCase { xContentBuilder.startObject(); xContentBuilder.field("job_id", jobId); xContentBuilder.array("indexes", "airline-data"); - xContentBuilder.array("types", "_doc"); xContentBuilder.endObject(); Request request = new Request("PUT", MachineLearning.BASE_PATH + "datafeeds/" + datafeedId); request.setJsonEntity(Strings.toString(xContentBuilder)); diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java index 9c19ffe639f..3d49e033218 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/CategorizationIT.java @@ -92,7 +92,6 @@ public class CategorizationIT extends MlNativeAutodetectIntegTestCase { String datafeedId = job.getId() + "-feed"; DatafeedConfig.Builder datafeedConfig = new DatafeedConfig.Builder(datafeedId, job.getId()); datafeedConfig.setIndices(Collections.singletonList(DATA_INDEX)); - datafeedConfig.setTypes(Collections.singletonList(DATA_TYPE)); DatafeedConfig datafeed = datafeedConfig.build(); registerDatafeed(datafeed); putDatafeed(datafeed); @@ -138,7 +137,6 @@ public class CategorizationIT extends MlNativeAutodetectIntegTestCase { String datafeedId = job.getId() + "-feed"; DatafeedConfig.Builder datafeedConfig = new DatafeedConfig.Builder(datafeedId, job.getId()); datafeedConfig.setIndices(Collections.singletonList(DATA_INDEX)); - datafeedConfig.setTypes(Collections.singletonList(DATA_TYPE)); DatafeedConfig datafeed = datafeedConfig.build(); registerDatafeed(datafeed); putDatafeed(datafeed); diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java index 69668f4543e..d5aa2c6b435 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java @@ -1177,7 +1177,7 @@ public class DatafeedJobsRestIT extends ESRestTestCase { Response build() throws IOException { Request request = new Request("PUT", MachineLearning.BASE_PATH + "datafeeds/" + datafeedId); request.setJsonEntity("{" - + "\"job_id\": \"" + jobId + "\",\"indexes\":[\"" + index + "\"],\"types\":[\"" + type + "\"]" + + "\"job_id\": \"" + jobId + "\",\"indexes\":[\"" + index + "\"]" + (source ? ",\"_source\":true" : "") + (scriptedFields == null ? "" : ",\"script_fields\":" + scriptedFields) + (aggregations == null ? "" : ",\"aggs\":" + aggregations) diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java index 15086317f8e..a84c8cab2f8 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteExpiredDataIT.java @@ -49,7 +49,7 @@ import static org.hamcrest.Matchers.lessThanOrEqualTo; public class DeleteExpiredDataIT extends MlNativeAutodetectIntegTestCase { private static final String DATA_INDEX = "delete-expired-data-test-data"; - private static final String DATA_TYPE = "my_type"; + private static final String DATA_TYPE = "doc"; @Before public void setUpData() throws IOException { @@ -111,7 +111,6 @@ public class DeleteExpiredDataIT extends MlNativeAutodetectIntegTestCase { String datafeedId = job.getId() + "-feed"; DatafeedConfig.Builder datafeedConfig = new DatafeedConfig.Builder(datafeedId, job.getId()); datafeedConfig.setIndices(Arrays.asList(DATA_INDEX)); - datafeedConfig.setTypes(Arrays.asList(DATA_TYPE)); DatafeedConfig datafeed = datafeedConfig.build(); registerDatafeed(datafeed); putDatafeed(datafeed); diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java index 9570f8d2887..42ae65f1c95 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/InterimResultsDeletedAfterReopeningJobIT.java @@ -109,7 +109,7 @@ public class InterimResultsDeletedAfterReopeningJobIT extends MlNativeAutodetect private void assertNoInterimResults(String jobId) { String indexName = AnomalyDetectorsIndex.jobResultsAliasedName(jobId); - SearchResponse search = client().prepareSearch(indexName).setTypes("result").setSize(1000) + SearchResponse search = client().prepareSearch(indexName).setSize(1000) .setQuery(QueryBuilders.termQuery("is_interim", true)).get(); assertThat(search.getHits().getTotalHits().value, equalTo(0L)); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractor.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractor.java index 8705c1beee8..74f05851c7d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractor.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractor.java @@ -24,11 +24,8 @@ class AggregationDataExtractor extends AbstractAggregationDataExtractor fields; final String[] indices; - final String[] types; final QueryBuilder query; final AggregatorFactories.Builder aggs; final long start; @@ -27,14 +26,13 @@ class AggregationDataExtractorContext { final boolean includeDocCount; final Map headers; - AggregationDataExtractorContext(String jobId, String timeField, Set fields, List indices, List types, - QueryBuilder query, AggregatorFactories.Builder aggs, long start, long end, boolean includeDocCount, + AggregationDataExtractorContext(String jobId, String timeField, Set fields, List indices, QueryBuilder query, + AggregatorFactories.Builder aggs, long start, long end, boolean includeDocCount, Map headers) { this.jobId = Objects.requireNonNull(jobId); this.timeField = Objects.requireNonNull(timeField); this.fields = Objects.requireNonNull(fields); this.indices = indices.toArray(new String[indices.size()]); - this.types = types.toArray(new String[types.size()]); this.query = Objects.requireNonNull(query); this.aggs = Objects.requireNonNull(aggs); this.start = start; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractorFactory.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractorFactory.java index 376e9507dcb..12c4a47228f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractorFactory.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractorFactory.java @@ -34,7 +34,6 @@ public class AggregationDataExtractorFactory implements DataExtractorFactory { job.getDataDescription().getTimeField(), job.getAnalysisConfig().analysisFields(), datafeedConfig.getIndices(), - datafeedConfig.getTypes(), datafeedConfig.getParsedQuery(), datafeedConfig.getParsedAggregations(), Intervals.alignToCeil(start, histogramInterval), diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/RollupDataExtractorFactory.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/RollupDataExtractorFactory.java index f0ee22ce85e..d5290611ab0 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/RollupDataExtractorFactory.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/RollupDataExtractorFactory.java @@ -56,7 +56,6 @@ public class RollupDataExtractorFactory implements DataExtractorFactory { job.getDataDescription().getTimeField(), job.getAnalysisConfig().analysisFields(), datafeedConfig.getIndices(), - datafeedConfig.getTypes(), datafeedConfig.getParsedQuery(), datafeedConfig.getParsedAggregations(), Intervals.alignToCeil(start, histogramInterval), diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractor.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractor.java index d9dd1c6e1ee..618ae6ee9a3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractor.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractor.java @@ -191,7 +191,7 @@ public class ChunkedDataExtractor implements DataExtractor { } private DataSummary newScrolledDataSummary() throws IOException { - SearchRequestBuilder searchRequestBuilder = rangeSearchRequest().setTypes(context.types); + SearchRequestBuilder searchRequestBuilder = rangeSearchRequest(); SearchResponse response = executeSearchRequest(searchRequestBuilder); LOGGER.debug("[{}] Scrolling Data summary response was obtained", context.jobId); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorContext.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorContext.java index bb32b40f7cd..1c1ac49ad27 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorContext.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorContext.java @@ -23,7 +23,6 @@ class ChunkedDataExtractorContext { final String jobId; final String timeField; final String[] indices; - final String[] types; final QueryBuilder query; final int scrollSize; final long start; @@ -34,14 +33,12 @@ class ChunkedDataExtractorContext { final boolean hasAggregations; final Long histogramInterval; - ChunkedDataExtractorContext(String jobId, String timeField, List indices, List types, - QueryBuilder query, int scrollSize, long start, long end, @Nullable TimeValue chunkSpan, - TimeAligner timeAligner, Map headers, boolean hasAggregations, - @Nullable Long histogramInterval) { + ChunkedDataExtractorContext(String jobId, String timeField, List indices, QueryBuilder query, int scrollSize, long start, + long end, @Nullable TimeValue chunkSpan, TimeAligner timeAligner, Map headers, + boolean hasAggregations, @Nullable Long histogramInterval) { this.jobId = Objects.requireNonNull(jobId); this.timeField = Objects.requireNonNull(timeField); this.indices = indices.toArray(new String[indices.size()]); - this.types = types.toArray(new String[types.size()]); this.query = Objects.requireNonNull(query); this.scrollSize = scrollSize; this.start = start; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorFactory.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorFactory.java index 68161507ed7..76a05e6b4d1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorFactory.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorFactory.java @@ -35,7 +35,6 @@ public class ChunkedDataExtractorFactory implements DataExtractorFactory { job.getId(), job.getDataDescription().getTimeField(), datafeedConfig.getIndices(), - datafeedConfig.getTypes(), datafeedConfig.getParsedQuery(), datafeedConfig.getScrollSize(), timeAligner.alignToCeil(start), diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractor.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractor.java index d890ce8a3fe..5e6eb96637d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractor.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractor.java @@ -106,7 +106,6 @@ class ScrollDataExtractor implements DataExtractor { .setScroll(SCROLL_TIMEOUT) .addSort(context.extractedFields.timeField(), SortOrder.ASC) .setIndices(context.indices) - .setTypes(context.types) .setSize(context.scrollSize) .setQuery(ExtractorUtils.wrapInTimeRangeQuery( context.query, context.extractedFields.timeField(), start, context.end)); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorContext.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorContext.java index 08e693849ec..ac05c133086 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorContext.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorContext.java @@ -18,7 +18,6 @@ class ScrollDataExtractorContext { final String jobId; final TimeBasedExtractedFields extractedFields; final String[] indices; - final String[] types; final QueryBuilder query; final List scriptFields; final int scrollSize; @@ -26,13 +25,12 @@ class ScrollDataExtractorContext { final long end; final Map headers; - ScrollDataExtractorContext(String jobId, TimeBasedExtractedFields extractedFields, List indices, List types, - QueryBuilder query, List scriptFields, int scrollSize, - long start, long end, Map headers) { + ScrollDataExtractorContext(String jobId, TimeBasedExtractedFields extractedFields, List indices, QueryBuilder query, + List scriptFields, int scrollSize, long start, long end, + Map headers) { this.jobId = Objects.requireNonNull(jobId); this.extractedFields = Objects.requireNonNull(extractedFields); this.indices = indices.toArray(new String[indices.size()]); - this.types = types.toArray(new String[types.size()]); this.query = Objects.requireNonNull(query); this.scriptFields = Objects.requireNonNull(scriptFields); this.scrollSize = scrollSize; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorFactory.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorFactory.java index 986387c2ed8..763d718bcc7 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorFactory.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorFactory.java @@ -43,7 +43,6 @@ public class ScrollDataExtractorFactory implements DataExtractorFactory { job.getId(), extractedFields, datafeedConfig.getIndices(), - datafeedConfig.getTypes(), datafeedConfig.getParsedQuery(), datafeedConfig.getScriptFields(), datafeedConfig.getScrollSize(), diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MlMetadataTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MlMetadataTests.java index c7ca2ff805e..2377bc5921e 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MlMetadataTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MlMetadataTests.java @@ -282,7 +282,6 @@ public class MlMetadataTests extends AbstractSerializingTestCase { DatafeedConfig updatedDatafeed = updatedMetadata.getDatafeed(datafeedConfig1.getId()); assertThat(updatedDatafeed.getJobId(), equalTo(datafeedConfig1.getJobId())); assertThat(updatedDatafeed.getIndices(), equalTo(datafeedConfig1.getIndices())); - assertThat(updatedDatafeed.getTypes(), equalTo(datafeedConfig1.getTypes())); assertThat(updatedDatafeed.getScrollSize(), equalTo(5000)); } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidatorTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidatorTests.java index 4007671bbbc..3c34c2e1d67 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidatorTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedJobValidatorTests.java @@ -229,7 +229,6 @@ public class DatafeedJobValidatorTests extends ESTestCase { private static DatafeedConfig.Builder createValidDatafeedConfig() { DatafeedConfig.Builder builder = new DatafeedConfig.Builder("my-datafeed", "my-job"); builder.setIndices(Collections.singletonList("myIndex")); - builder.setTypes(Collections.singletonList("myType")); return builder; } } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManagerTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManagerTests.java index 54aa3ade8e1..edf73454409 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManagerTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManagerTests.java @@ -340,7 +340,6 @@ public class DatafeedManagerTests extends ESTestCase { public static DatafeedConfig.Builder createDatafeedConfig(String datafeedId, String jobId) { DatafeedConfig.Builder datafeedConfig = new DatafeedConfig.Builder(datafeedId, jobId); datafeedConfig.setIndices(Collections.singletonList("myIndex")); - datafeedConfig.setTypes(Collections.singletonList("myType")); return datafeedConfig; } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/delayeddatacheck/DelayedDataDetectorFactoryTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/delayeddatacheck/DelayedDataDetectorFactoryTests.java index 3b1ca4c3071..d776b720ed2 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/delayeddatacheck/DelayedDataDetectorFactoryTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/delayeddatacheck/DelayedDataDetectorFactoryTests.java @@ -89,7 +89,6 @@ public class DelayedDataDetectorFactoryTests extends ESTestCase { private DatafeedConfig createDatafeed(boolean shouldDetectDelayedData, TimeValue delayedDatacheckWindow) { DatafeedConfig.Builder builder = new DatafeedConfig.Builder("id", "jobId"); builder.setIndices(Collections.singletonList("index1")); - builder.setTypes(Collections.singletonList("doc")); if (shouldDetectDelayedData) { builder.setDelayedDataCheckConfig(DelayedDataCheckConfig.enabledDelayedDataCheckConfig(delayedDatacheckWindow)); diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractorTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractorTests.java index 6561cfd56e2..bb7d1d1729c 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractorTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationDataExtractorTests.java @@ -51,7 +51,6 @@ public class AggregationDataExtractorTests extends ESTestCase { private String jobId; private String timeField; private Set fields; - private List types; private List indices; private QueryBuilder query; private AggregatorFactories.Builder aggs; @@ -84,7 +83,6 @@ public class AggregationDataExtractorTests extends ESTestCase { fields = new HashSet<>(); fields.addAll(Arrays.asList("time", "airline", "responsetime")); indices = Arrays.asList("index-1", "index-2"); - types = Arrays.asList("type-1", "type-2"); query = QueryBuilders.matchAllQuery(); aggs = new AggregatorFactories.Builder() .addAggregator(AggregationBuilders.histogram("time").field("time").interval(1000).subAggregation( @@ -267,7 +265,7 @@ public class AggregationDataExtractorTests extends ESTestCase { } private AggregationDataExtractorContext createContext(long start, long end) { - return new AggregationDataExtractorContext(jobId, timeField, fields, indices, types, query, aggs, start, end, true, + return new AggregationDataExtractorContext(jobId, timeField, fields, indices, query, aggs, start, end, true, Collections.emptyMap()); } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorTests.java index 20a5783dff7..c8e53dfcf7d 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/chunked/ChunkedDataExtractorTests.java @@ -49,7 +49,6 @@ public class ChunkedDataExtractorTests extends ESTestCase { private List capturedSearchRequests; private String jobId; private String timeField; - private List types; private List indices; private QueryBuilder query; private int scrollSize; @@ -86,7 +85,6 @@ public class ChunkedDataExtractorTests extends ESTestCase { jobId = "test-job"; timeField = "time"; indices = Arrays.asList("index-1", "index-2"); - types = Arrays.asList("type-1", "type-2"); query = QueryBuilders.matchAllQuery(); scrollSize = 1000; chunkSpan = null; @@ -561,7 +559,7 @@ public class ChunkedDataExtractorTests extends ESTestCase { } private ChunkedDataExtractorContext createContext(long start, long end, boolean hasAggregations, Long histogramInterval) { - return new ChunkedDataExtractorContext(jobId, timeField, indices, types, query, scrollSize, start, end, chunkSpan, + return new ChunkedDataExtractorContext(jobId, timeField, indices, query, scrollSize, start, end, chunkSpan, ChunkedDataExtractorFactory.newIdentityTimeAligner(), Collections.emptyMap(), hasAggregations, histogramInterval); } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/fields/TimeBasedExtractedFieldsTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/fields/TimeBasedExtractedFieldsTests.java index 5e388afad28..1fd6db3de56 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/fields/TimeBasedExtractedFieldsTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/fields/TimeBasedExtractedFieldsTests.java @@ -120,7 +120,6 @@ public class TimeBasedExtractedFieldsTests extends ESTestCase { DatafeedConfig.Builder datafeedBuilder = new DatafeedConfig.Builder("feed", jobBuilder.getId()); datafeedBuilder.setIndices(Collections.singletonList("foo")); - datafeedBuilder.setTypes(Collections.singletonList("doc")); datafeedBuilder.setScriptFields(Collections.singletonList(new SearchSourceBuilder.ScriptField("airport", null, false))); Map timeCaps = new HashMap<>(); @@ -200,7 +199,6 @@ public class TimeBasedExtractedFieldsTests extends ESTestCase { DatafeedConfig.Builder datafeedBuilder = new DatafeedConfig.Builder("feed", jobBuilder.getId()); datafeedBuilder.setIndices(Collections.singletonList("foo")); - datafeedBuilder.setTypes(Collections.singletonList("doc")); Map timeCaps = new HashMap<>(); timeCaps.put("date", createFieldCaps(false)); @@ -220,7 +218,6 @@ public class TimeBasedExtractedFieldsTests extends ESTestCase { DatafeedConfig.Builder datafeedBuilder = new DatafeedConfig.Builder("feed", jobBuilder.getId()); datafeedBuilder.setIndices(Collections.singletonList("foo")); - datafeedBuilder.setTypes(Collections.singletonList("doc")); Map timeCaps = new HashMap<>(); timeCaps.put("date", createFieldCaps(true)); @@ -241,7 +238,6 @@ public class TimeBasedExtractedFieldsTests extends ESTestCase { DatafeedConfig.Builder datafeedBuilder = new DatafeedConfig.Builder("feed", jobBuilder.getId()); datafeedBuilder.setIndices(Collections.singletonList("foo")); - datafeedBuilder.setTypes(Collections.singletonList("doc")); Map timeCaps = new HashMap<>(); timeCaps.put("date", createFieldCaps(true)); diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorTests.java index fbe721b6592..170c95d1cab 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/scroll/ScrollDataExtractorTests.java @@ -65,7 +65,6 @@ public class ScrollDataExtractorTests extends ESTestCase { private ArgumentCaptor capturedClearScrollRequests; private String jobId; private TimeBasedExtractedFields extractedFields; - private List types; private List indices; private QueryBuilder query; private List scriptFields; @@ -134,7 +133,6 @@ public class ScrollDataExtractorTests extends ESTestCase { extractedFields = new TimeBasedExtractedFields(timeField, Arrays.asList(timeField, ExtractedField.newField("field_1", ExtractedField.ExtractionMethod.DOC_VALUE))); indices = Arrays.asList("index-1", "index-2"); - types = Arrays.asList("type-1", "type-2"); query = QueryBuilders.matchAllQuery(); scriptFields = Collections.emptyList(); scrollSize = 1000; @@ -422,7 +420,7 @@ public class ScrollDataExtractorTests extends ESTestCase { List sFields = Arrays.asList(withoutSplit, withSplit); ScrollDataExtractorContext context = new ScrollDataExtractorContext(jobId, extractedFields, indices, - types, query, sFields, scrollSize, 1000, 2000, Collections.emptyMap()); + query, sFields, scrollSize, 1000, 2000, Collections.emptyMap()); TestDataExtractor extractor = new TestDataExtractor(context); @@ -467,7 +465,7 @@ public class ScrollDataExtractorTests extends ESTestCase { } private ScrollDataExtractorContext createContext(long start, long end) { - return new ScrollDataExtractorContext(jobId, extractedFields, indices, types, query, scriptFields, scrollSize, start, end, + return new ScrollDataExtractorContext(jobId, extractedFields, indices, query, scriptFields, scrollSize, start, end, Collections.emptyMap()); } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java index 3c07db3a9ab..44cdd2434ae 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java @@ -199,7 +199,6 @@ public abstract class BaseMlIntegTestCase extends ESIntegTestCase { builder.setQueryDelay(TimeValue.timeValueSeconds(1)); builder.setFrequency(TimeValue.timeValueSeconds(1)); builder.setIndices(indices); - builder.setTypes(Collections.singletonList("type")); return builder; } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml index a2914834c89..742fc00beda 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml @@ -80,8 +80,7 @@ setup: body: > { "job_id":"a-missing-job", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } --- @@ -105,13 +104,11 @@ setup: body: > { "job_id":"datafeeds-crud-1", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } - match: { datafeed_id: "test-datafeed-1" } - match: { job_id: "datafeeds-crud-1" } - match: { indices: ["index-foo"] } - - match: { types: ["type-bar"] } - match: { scroll_size: 1000 } - is_true: query.match_all - match: { chunking_config: { mode: "auto" }} @@ -124,8 +121,7 @@ setup: body: > { "job_id":"datafeeds-crud-1", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } - match: { datafeed_id: "test-datafeed-1" } @@ -136,8 +132,7 @@ setup: body: > { "job_id":"datafeeds-crud-2", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } --- @@ -148,8 +143,7 @@ setup: body: > { "job_id":"datafeeds-crud-1", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } - match: { datafeed_id: "test-datafeed-1" } @@ -160,8 +154,7 @@ setup: body: > { "job_id":"datafeeds-crud-1", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } --- @@ -174,7 +167,6 @@ setup: { "job_id":"datafeeds-crud-1", "indexes":["index-foo"], - "types":["type-bar"], "query":{"match_all_misspelled":{}} } @@ -187,7 +179,6 @@ setup: { "job_id":"datafeeds-crud-1", "indexes":["index-foo"], - "types":["type-bar"], "scroll_size": 2000, "frequency": "1m", "query_delay": "30s" @@ -206,7 +197,6 @@ setup: - match: { datafeed_id: "test-datafeed-1" } - match: { job_id: "datafeeds-crud-1" } - match: { indices: ["index-*"] } - - match: { types: ["type-bar"] } - match: { scroll_size: 10000 } - match: { frequency: "2m" } - match: { query_delay: "0s" } @@ -220,7 +210,6 @@ setup: { "job_id":"datafeeds-crud-1", "indexes":["index-foo"], - "types":["type-bar"], "scroll_size": 2000 } @@ -234,7 +223,6 @@ setup: - match: { datafeed_id: "test-datafeed-1" } - match: { job_id: "datafeeds-crud-2" } - match: { indices: ["index-foo"] } - - match: { types: ["type-bar"] } --- "Test update datafeed with missing id": @@ -255,7 +243,6 @@ setup: { "job_id":"datafeeds-crud-1", "indexes":["index-foo"], - "types":["type-bar"], "scroll_size": 2000 } @@ -276,8 +263,7 @@ setup: body: > { "job_id":"datafeeds-crud-1", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } - do: @@ -286,8 +272,7 @@ setup: body: > { "job_id":"datafeeds-crud-2", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } - do: @@ -315,7 +300,6 @@ setup: { "job_id":"datafeeds-crud-1", "indices":["index-foo"], - "types":["type-bar"], "chunking_config": {"mode":"manual","time_span": "1h"} } - match: { datafeed_id: "test-datafeed-1" } @@ -331,7 +315,6 @@ setup: { "job_id":"datafeeds-crud-1", "indices":["index-foo"], - "types":["type-bar"], "aggs": { "histogram_buckets":{ "date_histogram": { @@ -385,8 +368,7 @@ setup: body: > { "job_id":"datafeeds-crud-1", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } - match: { datafeed_id: "test-datafeed-1" } @@ -403,8 +385,7 @@ setup: body: > { "job_id":"datafeeds-crud-1", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } - match: { datafeed_id: "test-datafeed-1" } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_job_force.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_job_force.yml index b5e3e68c3c5..8e12056c27f 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_job_force.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_job_force.yml @@ -65,8 +65,7 @@ setup: body: > { "job_id":"force-delete-job", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } - match: { datafeed_id: force-delete-job-datafeed } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeed_stats.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeed_stats.yml index 0c89c444d00..70626a0afd7 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeed_stats.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeed_stats.yml @@ -81,8 +81,7 @@ setup: body: > { "job_id":"get-datafeed-stats-1", - "indexes":["index-1"], - "types":["type-1"] + "indexes":["index-1"] } - do: @@ -93,8 +92,7 @@ setup: body: > { "job_id":"get-datafeed-stats-2", - "indexes":["index-2"], - "types":["type-2"] + "indexes":["index-2"] } --- diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeeds.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeeds.yml index 5595f4d9907..414ee9acb22 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeeds.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeeds.yml @@ -45,8 +45,7 @@ setup: body: > { "job_id":"get-datafeed-1", - "indexes":["index-1"], - "types":["type-1"] + "indexes":["index-1"] } - do: @@ -57,8 +56,7 @@ setup: body: > { "job_id":"get-datafeed-2", - "indexes":["index-2"], - "types":["type-2"] + "indexes":["index-2"] } --- diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_crud.yml index 7a6bec44bc0..1ab385aee91 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_crud.yml @@ -516,8 +516,7 @@ body: > { "job_id":"jobs-crud-datafeed-job", - "indexes":["index-foo"], - "types":["type-bar"] + "indexes":["index-foo"] } - match: { datafeed_id: "jobs-crud-test-datafeed-1" } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_stats.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_stats.yml index 9f9f6826325..e29700e423b 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_stats.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_stats.yml @@ -66,8 +66,7 @@ setup: body: > { "job_id":"jobs-get-stats-datafeed-job", - "indexes":["farequote"], - "types":["response"] + "indexes":["farequote"] } --- diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/preview_datafeed.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/preview_datafeed.yml index 2de179b395c..23cdb3b55c6 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/preview_datafeed.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/preview_datafeed.yml @@ -94,8 +94,7 @@ setup: body: > { "job_id":"preview-datafeed-job", - "indexes":"airline-data", - "types":"response" + "indexes":"airline-data" } - do: @@ -140,7 +139,6 @@ setup: { "job_id":"aggregation-doc-count-job", "indexes":"airline-data", - "types":"response", "aggregations": { "buckets": { "histogram": { @@ -213,7 +211,6 @@ setup: { "job_id":"aggregation-custom-single-metric-summary-job", "indexes":"airline-data", - "types":"response", "aggregations": { "buckets": { "histogram": { @@ -272,7 +269,6 @@ setup: { "job_id":"aggregation-custom-multi-metric-summary-job", "indexes":"airline-data", - "types":"response", "aggregations": { "buckets": { "histogram": { @@ -358,8 +354,7 @@ setup: body: > { "job_id":"unavailable-job", - "indexes":"unavailable-data", - "types":"response" + "indexes":"unavailable-data" } - do: @@ -391,7 +386,6 @@ setup: { "job_id":"empty-job", "indexes":"airline-data", - "types":"response", "query": { "term": {"airline":"missing"} } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/start_stop_datafeed.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/start_stop_datafeed.yml index 081709332dc..1dd201007f9 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/start_stop_datafeed.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/start_stop_datafeed.yml @@ -48,8 +48,7 @@ setup: body: > { "job_id":"start-stop-datafeed-job", - "indexes":"airline-data", - "types":"response" + "indexes":"airline-data" } --- @@ -222,8 +221,7 @@ setup: body: > { "job_id":"start-stop-datafeed-job-field-without-mappings", - "indexes":"airline-data", - "types":"response" + "indexes":"airline-data" } - do: @@ -330,8 +328,7 @@ setup: body: > { "job_id":"start-stop-datafeed-job-foo-1", - "indexes":"airline-data", - "types":"response" + "indexes":"airline-data" } - do: @@ -340,8 +337,7 @@ setup: body: > { "job_id":"start-stop-datafeed-job-foo-2", - "indexes":"airline-data", - "types":"response" + "indexes":"airline-data" } - do: @@ -350,8 +346,7 @@ setup: body: > { "job_id":"start-stop-datafeed-job-bar-1", - "indexes":"airline-data", - "types":"response" + "indexes":"airline-data" } - do: diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/40_ml_datafeed_crud.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/40_ml_datafeed_crud.yml index 97a793991f4..b9ae06499d1 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/40_ml_datafeed_crud.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/40_ml_datafeed_crud.yml @@ -5,7 +5,6 @@ datafeed_id: old-cluster-datafeed - match: { datafeeds.0.datafeed_id: "old-cluster-datafeed"} - length: { datafeeds.0.indices: 1 } - - length: { datafeeds.0.types: 1 } - gte: { datafeeds.0.scroll_size: 2000 } - do: @@ -43,7 +42,6 @@ { "job_id":"mixed-cluster-datafeed-job", "indices":["airline-data"], - "types":["response"], "scroll_size": 2000 } diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/40_ml_datafeed_crud.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/40_ml_datafeed_crud.yml index a1ab7dfb914..39864ae6d9c 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/40_ml_datafeed_crud.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/40_ml_datafeed_crud.yml @@ -23,7 +23,6 @@ setup: datafeed_id: old-cluster-datafeed - match: { datafeeds.0.datafeed_id: "old-cluster-datafeed"} - length: { datafeeds.0.indices: 1 } - - length: { datafeeds.0.types: 1 } - gte: { datafeeds.0.scroll_size: 2000 } - do: @@ -37,7 +36,6 @@ setup: datafeed_id: mixed-cluster-datafeed - match: { datafeeds.0.datafeed_id: "mixed-cluster-datafeed"} - length: { datafeeds.0.indices: 1 } - - length: { datafeeds.0.types: 1 } - gte: { datafeeds.0.scroll_size: 2000 } - do: diff --git a/x-pack/qa/transport-client-tests/src/test/java/org/elasticsearch/xpack/ml/client/MLTransportClientIT.java b/x-pack/qa/transport-client-tests/src/test/java/org/elasticsearch/xpack/ml/client/MLTransportClientIT.java index dceb2d1398a..1a4959c0be8 100644 --- a/x-pack/qa/transport-client-tests/src/test/java/org/elasticsearch/xpack/ml/client/MLTransportClientIT.java +++ b/x-pack/qa/transport-client-tests/src/test/java/org/elasticsearch/xpack/ml/client/MLTransportClientIT.java @@ -137,7 +137,6 @@ public class MLTransportClientIT extends ESXPackSmokeClientTestCase { String datafeedIndex = "ml-transport-client-test"; String datatype = "type-bar"; datafeed.setIndices(Collections.singletonList(datafeedIndex)); - datafeed.setTypes(Collections.singletonList("type-bar")); mlClient.putDatafeed(new PutDatafeedAction.Request(datafeed.build())).actionGet();