浏览代码

[ML] adding new flag exclude_generated that removes generated fields in GET config APIs (#63899)

When exporting and cloning ml configurations in a cluster it can be
frustrating to remove all the fields that were generated by
the plugin. Especially as the number of these fields change
from version to version.

This flag, exclude_generated, allows the GET config APIs to return
configurations with these generated fields removed.

APIs supporting this flag: 
- GET _ml/anomaly_detection/<job_id>
- GET _ml/datafeeds/<datafeed_id>
- GET _ml/data_frame/analytics/<analytics_id>

The following fields are not returned in the objects:

- any field that is not user settable (e.g. version, create_time)
- any field that is a calculated default value (e.g. datafeed chunking_config)
- any field that is automatically set via another Elastic stack process (e.g. anomaly job custom_settings.created_by)

relates to #63055
Benjamin Trent 5 年之前
父节点
当前提交
c1de07fa83
共有 30 个文件被更改,包括 146 次插入139 次删除
  1. 8 8
      client/rest-high-level/src/main/java/org/elasticsearch/client/MLRequestConverters.java
  2. 9 9
      client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetDataFrameAnalyticsRequest.java
  3. 9 9
      client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetDatafeedRequest.java
  4. 9 9
      client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetJobRequest.java
  5. 9 9
      client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetTrainedModelsRequest.java
  6. 4 4
      client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MlClientDocumentationIT.java
  7. 4 4
      docs/reference/ml/anomaly-detection/apis/get-datafeed.asciidoc
  8. 5 5
      docs/reference/ml/anomaly-detection/apis/get-job.asciidoc
  9. 30 30
      docs/reference/ml/df-analytics/apis/get-dfanalytics.asciidoc
  10. 2 2
      docs/reference/ml/df-analytics/apis/get-trained-models.asciidoc
  11. 2 2
      docs/reference/ml/ml-shared.asciidoc
  12. 4 5
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java
  13. 3 3
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/DataFrameAnalyticsConfig.java
  14. 3 3
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/TrainedModelConfig.java
  15. 3 3
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/Job.java
  16. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/ToXContentParams.java
  17. 21 10
      x-pack/plugin/ml/qa/basic-multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java
  18. 2 1
      x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/TrainedModelIT.java
  19. 2 2
      x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java
  20. 2 2
      x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java
  21. 2 2
      x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java
  22. 2 2
      x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java
  23. 1 1
      x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_data_frame_analytics.json
  24. 1 1
      x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_datafeeds.json
  25. 1 1
      x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_jobs.json
  26. 1 1
      x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_trained_models.json
  27. 1 2
      x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml
  28. 1 3
      x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml
  29. 3 3
      x-pack/plugin/src/test/resources/rest-api-spec/test/ml/inference_crud.yml
  30. 1 2
      x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get.yml

+ 8 - 8
client/rest-high-level/src/main/java/org/elasticsearch/client/MLRequestConverters.java

@@ -123,8 +123,8 @@ final class MLRequestConverters {
         if (getJobRequest.getAllowNoMatch() != null) {
             params.putParam(GetJobRequest.ALLOW_NO_MATCH.getPreferredName(), Boolean.toString(getJobRequest.getAllowNoMatch()));
         }
-        if (getJobRequest.getForExport() != null) {
-            params.putParam(GetJobRequest.FOR_EXPORT, Boolean.toString(getJobRequest.getForExport()));
+        if (getJobRequest.getExcludeGenerated() != null) {
+            params.putParam(GetJobRequest.EXCLUDE_GENERATED, Boolean.toString(getJobRequest.getExcludeGenerated()));
         }
         request.addParameters(params.asMap());
         return request;
@@ -273,8 +273,8 @@ final class MLRequestConverters {
             params.putParam(GetDatafeedRequest.ALLOW_NO_MATCH.getPreferredName(),
                     Boolean.toString(getDatafeedRequest.getAllowNoMatch()));
         }
-        if (getDatafeedRequest.getForExport() != null) {
-            params.putParam(GetDatafeedRequest.FOR_EXPORT, Boolean.toString(getDatafeedRequest.getForExport()));
+        if (getDatafeedRequest.getExcludeGenerated() != null) {
+            params.putParam(GetDatafeedRequest.EXCLUDE_GENERATED, Boolean.toString(getDatafeedRequest.getExcludeGenerated()));
         }
         request.addParameters(params.asMap());
         return request;
@@ -653,8 +653,8 @@ final class MLRequestConverters {
         if (getRequest.getAllowNoMatch() != null) {
             params.putParam(GetDataFrameAnalyticsRequest.ALLOW_NO_MATCH, Boolean.toString(getRequest.getAllowNoMatch()));
         }
-        if (getRequest.getForExport() != null) {
-            params.putParam(GetDataFrameAnalyticsRequest.FOR_EXPORT, Boolean.toString(getRequest.getForExport()));
+        if (getRequest.getExcludeGenerated() != null) {
+            params.putParam(GetDataFrameAnalyticsRequest.EXCLUDE_GENERATED, Boolean.toString(getRequest.getExcludeGenerated()));
         }
         request.addParameters(params.asMap());
         return request;
@@ -795,8 +795,8 @@ final class MLRequestConverters {
         if (getTrainedModelsRequest.getTags() != null) {
             params.putParam(GetTrainedModelsRequest.TAGS, Strings.collectionToCommaDelimitedString(getTrainedModelsRequest.getTags()));
         }
-        if (getTrainedModelsRequest.getForExport() != null) {
-            params.putParam(GetTrainedModelsRequest.FOR_EXPORT, Boolean.toString(getTrainedModelsRequest.getForExport()));
+        if (getTrainedModelsRequest.getExcludeGenerated() != null) {
+            params.putParam(GetTrainedModelsRequest.EXCLUDE_GENERATED, Boolean.toString(getTrainedModelsRequest.getExcludeGenerated()));
         }
         Request request = new Request(HttpGet.METHOD_NAME, endpoint);
         request.addParameters(params.asMap());

+ 9 - 9
client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetDataFrameAnalyticsRequest.java

@@ -32,12 +32,12 @@ import java.util.Optional;
 public class GetDataFrameAnalyticsRequest implements Validatable {
 
     public static final String ALLOW_NO_MATCH = "allow_no_match";
-    public static final String FOR_EXPORT = "for_export";
+    public static final String EXCLUDE_GENERATED = "exclude_generated";
 
     private final List<String> ids;
     private Boolean allowNoMatch;
     private PageParams pageParams;
-    private Boolean forExport;
+    private Boolean excludeGenerated;
 
     /**
      * Helper method to create a request that will get ALL Data Frame Analytics
@@ -65,14 +65,14 @@ public class GetDataFrameAnalyticsRequest implements Validatable {
      * This is useful when getting the configuration and wanting to put it in another cluster.
      *
      * Default value is false.
-     * @param forExport Boolean value indicating if certain fields should be removed
+     * @param excludeGenerated Boolean value indicating if certain fields should be removed
      */
-    public void setForExport(boolean forExport) {
-        this.forExport = forExport;
+    public void setExcludeGenerated(boolean excludeGenerated) {
+        this.excludeGenerated = excludeGenerated;
     }
 
-    public Boolean getForExport() {
-        return forExport;
+    public Boolean getExcludeGenerated() {
+        return excludeGenerated;
     }
 
     /**
@@ -111,12 +111,12 @@ public class GetDataFrameAnalyticsRequest implements Validatable {
         GetDataFrameAnalyticsRequest other = (GetDataFrameAnalyticsRequest) o;
         return Objects.equals(ids, other.ids)
             && Objects.equals(allowNoMatch, other.allowNoMatch)
-            && Objects.equals(forExport, other.forExport)
+            && Objects.equals(excludeGenerated, other.excludeGenerated)
             && Objects.equals(pageParams, other.pageParams);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(ids, allowNoMatch, forExport, pageParams);
+        return Objects.hash(ids, allowNoMatch, excludeGenerated, pageParams);
     }
 }

+ 9 - 9
client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetDatafeedRequest.java

@@ -41,12 +41,12 @@ public class GetDatafeedRequest implements Validatable, ToXContentObject {
 
     public static final ParseField DATAFEED_IDS = new ParseField("datafeed_ids");
     public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match");
-    public static final String FOR_EXPORT = "for_export";
+    public static final String EXCLUDE_GENERATED = "exclude_generated";
 
     private static final String ALL_DATAFEEDS = "_all";
     private final List<String> datafeedIds;
     private Boolean allowNoMatch;
-    private Boolean forExport;
+    private Boolean excludeGenerated;
 
     @SuppressWarnings("unchecked")
     public static final ConstructingObjectParser<GetDatafeedRequest, Void> PARSER = new ConstructingObjectParser<>(
@@ -108,19 +108,19 @@ public class GetDatafeedRequest implements Validatable, ToXContentObject {
      * This is useful when getting the configuration and wanting to put it in another cluster.
      *
      * Default value is false.
-     * @param forExport Boolean value indicating if certain fields should be removed
+     * @param excludeGenerated Boolean value indicating if certain fields should be removed
      */
-    public void setForExport(boolean forExport) {
-        this.forExport = forExport;
+    public void setExcludeGenerated(boolean excludeGenerated) {
+        this.excludeGenerated = excludeGenerated;
     }
 
-    public Boolean getForExport() {
-        return forExport;
+    public Boolean getExcludeGenerated() {
+        return excludeGenerated;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(datafeedIds, forExport, allowNoMatch);
+        return Objects.hash(datafeedIds, excludeGenerated, allowNoMatch);
     }
 
     @Override
@@ -136,7 +136,7 @@ public class GetDatafeedRequest implements Validatable, ToXContentObject {
         GetDatafeedRequest that = (GetDatafeedRequest) other;
         return Objects.equals(datafeedIds, that.datafeedIds) &&
             Objects.equals(allowNoMatch, that.allowNoMatch) &&
-            Objects.equals(forExport, that.forExport);
+            Objects.equals(excludeGenerated, that.excludeGenerated);
     }
 
     @Override

+ 9 - 9
client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetJobRequest.java

@@ -42,12 +42,12 @@ public class GetJobRequest implements Validatable, ToXContentObject {
 
     public static final ParseField JOB_IDS = new ParseField("job_ids");
     public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match");
-    public static final String FOR_EXPORT = "for_export";
+    public static final String EXCLUDE_GENERATED = "exclude_generated";
 
     private static final String ALL_JOBS = "_all";
     private final List<String> jobIds;
     private Boolean allowNoMatch;
-    private Boolean forExport;
+    private Boolean excludeGenerated;
 
     @SuppressWarnings("unchecked")
     public static final ConstructingObjectParser<GetJobRequest, Void> PARSER = new ConstructingObjectParser<>(
@@ -108,19 +108,19 @@ public class GetJobRequest implements Validatable, ToXContentObject {
      * This is useful when getting the configuration and wanting to put it in another cluster.
      *
      * Default value is false.
-     * @param forExport Boolean value indicating if certain fields should be removed
+     * @param excludeGenerated Boolean value indicating if certain fields should be removed
      */
-    public void setForExport(boolean forExport) {
-        this.forExport = forExport;
+    public void setExcludeGenerated(boolean excludeGenerated) {
+        this.excludeGenerated = excludeGenerated;
     }
 
-    public Boolean getForExport() {
-        return forExport;
+    public Boolean getExcludeGenerated() {
+        return excludeGenerated;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(jobIds, forExport, allowNoMatch);
+        return Objects.hash(jobIds, excludeGenerated, allowNoMatch);
     }
 
     @Override
@@ -135,7 +135,7 @@ public class GetJobRequest implements Validatable, ToXContentObject {
 
         GetJobRequest that = (GetJobRequest) other;
         return Objects.equals(jobIds, that.jobIds) &&
-            Objects.equals(forExport, that.forExport) &&
+            Objects.equals(excludeGenerated, that.excludeGenerated) &&
             Objects.equals(allowNoMatch, that.allowNoMatch);
     }
 

+ 9 - 9
client/rest-high-level/src/main/java/org/elasticsearch/client/ml/GetTrainedModelsRequest.java

@@ -39,7 +39,7 @@ public class GetTrainedModelsRequest implements Validatable {
     private static final String TOTAL_FEATURE_IMPORTANCE = "total_feature_importance";
     private static final String FEATURE_IMPORTANCE_BASELINE = "feature_importance_baseline";
     public static final String ALLOW_NO_MATCH = "allow_no_match";
-    public static final String FOR_EXPORT = "for_export";
+    public static final String EXCLUDE_GENERATED = "exclude_generated";
     public static final String DECOMPRESS_DEFINITION = "decompress_definition";
     public static final String TAGS = "tags";
     public static final String INCLUDE = "include";
@@ -48,7 +48,7 @@ public class GetTrainedModelsRequest implements Validatable {
     private Boolean allowNoMatch;
     private Set<String> includes = new HashSet<>();
     private Boolean decompressDefinition;
-    private Boolean forExport;
+    private Boolean excludeGenerated;
     private PageParams pageParams;
     private List<String> tags;
 
@@ -163,8 +163,8 @@ public class GetTrainedModelsRequest implements Validatable {
         return setTags(Arrays.asList(tags));
     }
 
-    public Boolean getForExport() {
-        return forExport;
+    public Boolean getExcludeGenerated() {
+        return excludeGenerated;
     }
 
     /**
@@ -173,10 +173,10 @@ public class GetTrainedModelsRequest implements Validatable {
      * This is useful when getting the model and wanting to put it in another cluster.
      *
      * Default value is false.
-     * @param forExport Boolean value indicating if certain fields should be removed from the mode on GET
+     * @param excludeGenerated Boolean value indicating if certain fields should be removed from the mode on GET
      */
-    public GetTrainedModelsRequest setForExport(Boolean forExport) {
-        this.forExport = forExport;
+    public GetTrainedModelsRequest setExcludeGenerated(Boolean excludeGenerated) {
+        this.excludeGenerated = excludeGenerated;
         return this;
     }
 
@@ -198,12 +198,12 @@ public class GetTrainedModelsRequest implements Validatable {
             && Objects.equals(allowNoMatch, other.allowNoMatch)
             && Objects.equals(decompressDefinition, other.decompressDefinition)
             && Objects.equals(includes, other.includes)
-            && Objects.equals(forExport, other.forExport)
+            && Objects.equals(excludeGenerated, other.excludeGenerated)
             && Objects.equals(pageParams, other.pageParams);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(ids, allowNoMatch, pageParams, decompressDefinition, includes, forExport);
+        return Objects.hash(ids, allowNoMatch, pageParams, decompressDefinition, includes, excludeGenerated);
     }
 }

+ 4 - 4
client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MlClientDocumentationIT.java

@@ -343,7 +343,7 @@ public class MlClientDocumentationIT extends ESRestHighLevelClientTestCase {
             // tag::get-job-request
             GetJobRequest request = new GetJobRequest("get-machine-learning-job1", "get-machine-learning-job*"); // <1>
             request.setAllowNoMatch(true); // <2>
-            request.setForExport(false); // <3>
+            request.setExcludeGenerated(false); // <3>
             // end::get-job-request
 
             // tag::get-job-execute
@@ -840,7 +840,7 @@ public class MlClientDocumentationIT extends ESRestHighLevelClientTestCase {
             // tag::get-datafeed-request
             GetDatafeedRequest request = new GetDatafeedRequest(datafeedId); // <1>
             request.setAllowNoMatch(true); // <2>
-            request.setForExport(false); // <3>
+            request.setExcludeGenerated(false); // <3>
             // end::get-datafeed-request
 
             // tag::get-datafeed-execute
@@ -2866,7 +2866,7 @@ public class MlClientDocumentationIT extends ESRestHighLevelClientTestCase {
         {
             // tag::get-data-frame-analytics-request
             GetDataFrameAnalyticsRequest request = new GetDataFrameAnalyticsRequest("my-analytics-config"); // <1>
-            request.setForExport(false); // <2>
+            request.setExcludeGenerated(false); // <2>
             // end::get-data-frame-analytics-request
 
             // tag::get-data-frame-analytics-execute
@@ -3728,7 +3728,7 @@ public class MlClientDocumentationIT extends ESRestHighLevelClientTestCase {
                 .setDecompressDefinition(false) // <6>
                 .setAllowNoMatch(true) // <7>
                 .setTags("regression") // <8>
-                .setForExport(false); // <9>
+                .setExcludeGenerated(false); // <9>
             // end::get-trained-models-request
             request.setTags((List<String>)null);
 

+ 4 - 4
docs/reference/ml/anomaly-detection/apis/get-datafeed.asciidoc

@@ -19,7 +19,7 @@ Retrieves configuration information for {dfeeds}.
 
 `GET _ml/datafeeds/` +
 
-`GET _ml/datafeeds/_all` 
+`GET _ml/datafeeds/_all`
 
 [[ml-get-datafeed-prereqs]]
 == {api-prereq-title}
@@ -36,7 +36,7 @@ comma-separated list of {dfeeds} or a wildcard expression. You can get
 information for all {dfeeds} by using `_all`, by specifying `*` as the
 `<feed_id>`, or by omitting the `<feed_id>`.
 
-IMPORTANT: This API returns a maximum of 10,000 {dfeeds}. 
+IMPORTANT: This API returns a maximum of 10,000 {dfeeds}.
 
 [[ml-get-datafeed-path-parms]]
 == {api-path-parms-title}
@@ -57,9 +57,9 @@ all {dfeeds}.
 (Optional, boolean)
 include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-datafeeds]
 
-`for_export`::
+`exclude_generated`::
 (Optional, boolean)
-include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=for-export]
+include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-generated]
 
 [[ml-get-datafeed-results]]
 == {api-response-body-title}

+ 5 - 5
docs/reference/ml/anomaly-detection/apis/get-job.asciidoc

@@ -34,7 +34,7 @@ using a group name, a comma-separated list of jobs, or a wildcard expression.
 You can get information for all {anomaly-jobs} by using `_all`, by specifying
 `*` as the `<job_id>`, or by omitting the `<job_id>`.
 
-IMPORTANT: This API returns a maximum of 10,000 jobs. 
+IMPORTANT: This API returns a maximum of 10,000 jobs.
 
 [[ml-get-job-path-parms]]
 == {api-path-parms-title}
@@ -50,9 +50,9 @@ include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-defaul
 (Optional, boolean)
 include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
 
-`for_export`::
+`exclude_generated`::
 (Optional, boolean)
-include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=for-export]
+include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-generated]
 
 [[ml-get-job-results]]
 == {api-response-body-title}
@@ -63,7 +63,7 @@ properties, see <<ml-put-job-request-body,create {anomaly-jobs} API>>.
 `create_time`::
 (string) The time the job was created. For example, `1491007356077`. This
 property is informational; you cannot change its value.
-  
+
 `finished_time`::
 (string) If the job closed or failed, this is the time the job finished,
 otherwise it is `null`. This property is informational; you cannot change its
@@ -83,7 +83,7 @@ include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-snapshot-id]
 == {api-response-codes-title}
 
 `404` (Missing resources)::
-  If `allow_no_match` is `false`, this code indicates that there are no 
+  If `allow_no_match` is `false`, this code indicates that there are no
   resources that match the request or only partial matches for the request.
 
 [[ml-get-job-example]]

+ 30 - 30
docs/reference/ml/df-analytics/apis/get-dfanalytics.asciidoc

@@ -27,18 +27,18 @@ experimental[]
 [[ml-get-dfanalytics-prereq]]
 == {api-prereq-title}
 
-If the {es} {security-features} are enabled, you must have the following 
+If the {es} {security-features} are enabled, you must have the following
 privileges:
 
 * cluster: `monitor_ml`
-  
+
 For more information, see <<security-privileges>> and {ml-docs-setup-privileges}.
 
 
 [[ml-get-dfanalytics-desc]]
 == {api-description-title}
 
-You can get information for multiple {dfanalytics-jobs} in a single API request 
+You can get information for multiple {dfanalytics-jobs} in a single API request
 by using a comma-separated list of {dfanalytics-jobs} or a wildcard expression.
 
 
@@ -46,12 +46,12 @@ by using a comma-separated list of {dfanalytics-jobs} or a wildcard expression.
 == {api-path-parms-title}
 
 `<data_frame_analytics_id>`::
-(Optional, string) 
+(Optional, string)
 include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-data-frame-analytics-default]
 +
 --
-You can get information for all {dfanalytics-jobs} by using _all, by specifying 
-`*` as the `<data_frame_analytics_id>`, or by omitting the 
+You can get information for all {dfanalytics-jobs} by using _all, by specifying
+`*` as the `<data_frame_analytics_id>`, or by omitting the
 `<data_frame_analytics_id>`.
 --
 
@@ -60,20 +60,20 @@ You can get information for all {dfanalytics-jobs} by using _all, by specifying
 == {api-query-parms-title}
 
 `allow_no_match`::
-(Optional, boolean) 
+(Optional, boolean)
 include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-match]
 
 `from`::
-(Optional, integer) 
+(Optional, integer)
 include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=from]
 
 `size`::
-(Optional, integer) 
+(Optional, integer)
 include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=size]
 
-`for_export`::
+`exclude_generated`::
 (Optional, boolean)
-include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=for-export]
+include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-generated]
 
 [role="child_attributes"]
 [[ml-get-dfanalytics-results]]
@@ -81,7 +81,7 @@ include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=for-export]
 
 `data_frame_analytics`::
 (array)
-An array of {dfanalytics-job} resources, which are sorted by the `id` value in 
+An array of {dfanalytics-job} resources, which are sorted by the `id` value in
 ascending order.
 +
 .Properties of {dfanalytics-job} resources
@@ -92,18 +92,18 @@ ascending order.
 
 //Begin analyzed_fields
 `analyzed_fields`:::
-(object) Contains `includes` and/or `excludes` patterns that select which fields 
+(object) Contains `includes` and/or `excludes` patterns that select which fields
 are included in the analysis.
 +
 .Properties of `analyzed_fields`
 [%collapsible%open]
 =====
 `excludes`:::
-(Optional, array) An array of strings that defines the fields that are excluded 
+(Optional, array) An array of strings that defines the fields that are excluded
 from the analysis.
-    
+
 `includes`:::
-(Optional, array) An array of strings that defines the fields that are included 
+(Optional, array) An array of strings that defines the fields that are included
 in the analysis.
 =====
 //End analyzed_fields
@@ -115,11 +115,11 @@ in the analysis.
 [%collapsible%open]
 =====
 `index`:::
-(string) The _destination index_ that stores the results of the 
+(string) The _destination index_ that stores the results of the
 {dfanalytics-job}.
 
 `results_field`:::
-(string) The name of the field that stores the results of the analysis. Defaults 
+(string) The name of the field that stores the results of the analysis. Defaults
 to `ml`.
 =====
 //End dest
@@ -131,36 +131,36 @@ to `ml`.
 (string) The `model_memory_limit` that has been set to the {dfanalytics-job}.
 
 `source`:::
-(object) The configuration of how the analysis data is sourced. It has an 
+(object) The configuration of how the analysis data is sourced. It has an
 `index` parameter and optionally a `query` and a `_source`.
 +
 .Properties of `source`
 [%collapsible%open]
 =====
 `index`:::
-(array) Index or indices on which to perform the analysis. It can be a single 
+(array) Index or indices on which to perform the analysis. It can be a single
 index or index pattern as well as an array of indices or patterns.
-    
+
 `query`:::
-(object) The query that has been specified for the {dfanalytics-job}. The {es} 
-query domain-specific language (<<query-dsl,DSL>>). This value corresponds to 
-the query object in an {es} search POST body. By default, this property has the 
+(object) The query that has been specified for the {dfanalytics-job}. The {es}
+query domain-specific language (<<query-dsl,DSL>>). This value corresponds to
+the query object in an {es} search POST body. By default, this property has the
 following value: `{"match_all": {}}`.
 
 `_source`:::
-(object) Contains the specified `includes` and/or `excludes` patterns that 
-select which fields are present in the destination. Fields that are excluded 
+(object) Contains the specified `includes` and/or `excludes` patterns that
+select which fields are present in the destination. Fields that are excluded
 cannot be included in the analysis.
 +
 .Properties of `_source`
 [%collapsible%open]
 ======
 `excludes`:::
-(array) An array of strings that defines the fields that are excluded from the 
+(array) An array of strings that defines the fields that are excluded from the
 destination.
-        
+
 `includes`:::
-(array) An array of strings that defines the fields that are included in the 
+(array) An array of strings that defines the fields that are included in the
 destination.
 ======
 //End of _source
@@ -180,7 +180,7 @@ destination.
 [[ml-get-dfanalytics-example]]
 == {api-examples-title}
 
-The following example gets configuration information for the `loganalytics` 
+The following example gets configuration information for the `loganalytics`
 {dfanalytics-job}:
 
 [source,console]

+ 2 - 2
docs/reference/ml/df-analytics/apis/get-trained-models.asciidoc

@@ -65,9 +65,9 @@ include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-match-models]
 Specifies whether the included model definition should be returned as a JSON map
 (`true`) or in a custom compressed format (`false`). Defaults to `true`.
 
-`for_export`::
+`exclude_generated`::
 (Optional, boolean)
-include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=for-export]
+include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-generated]
 
 `from`::
 (Optional, integer)

+ 2 - 2
docs/reference/ml/ml-shared.asciidoc

@@ -678,11 +678,11 @@ The number of individual forecasts currently available for the job. A value of
 `1` or more indicates that forecasts exist.
 end::forecast-total[]
 
-tag::for-export[]
+tag::exclude-generated[]
 Indicates if certain fields should be removed from the configuration on
 retrieval. This allows the configuration to be in an acceptable format to be retrieved
 and then added to another cluster. Default is false.
-end::for-export[]
+end::exclude-generated[]
 
 tag::frequency[]
 The interval at which scheduled queries are made while the {dfeed} runs in real

+ 4 - 5
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java

@@ -50,7 +50,7 @@ import java.util.Objects;
 import java.util.Random;
 import java.util.concurrent.TimeUnit;
 
-import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.FOR_EXPORT;
+import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
 
 /**
  * Datafeed configuration options. Describes where to proactively pull input
@@ -457,10 +457,9 @@ public class DatafeedConfig extends AbstractDiffable<DatafeedConfig> implements
     @Override
     public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
         builder.startObject();
-        if (params.paramAsBoolean(FOR_EXPORT, false) == false) {
-            builder.field(ID.getPreferredName(), id);
-            // We don't include the job_id in export as we assume the PUT will be referring to a new job as well
-            builder.field(Job.ID.getPreferredName(), jobId);
+        builder.field(ID.getPreferredName(), id);
+        builder.field(Job.ID.getPreferredName(), jobId);
+        if (params.paramAsBoolean(EXCLUDE_GENERATED, false) == false) {
             if (params.paramAsBoolean(ToXContentParams.FOR_INTERNAL_STORAGE, false)) {
                 builder.field(CONFIG_TYPE.getPreferredName(), TYPE);
             }

+ 3 - 3
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/DataFrameAnalyticsConfig.java

@@ -34,7 +34,7 @@ import java.util.Objects;
 
 import static org.elasticsearch.common.xcontent.ObjectParser.ValueType.OBJECT_ARRAY_BOOLEAN_OR_STRING;
 import static org.elasticsearch.common.xcontent.ObjectParser.ValueType.VALUE;
-import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.FOR_EXPORT;
+import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
 
 public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
 
@@ -227,8 +227,8 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
     @Override
     public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
         builder.startObject();
-        if (params.paramAsBoolean(FOR_EXPORT, false) == false) {
-            builder.field(ID.getPreferredName(), id);
+        builder.field(ID.getPreferredName(), id);
+        if (params.paramAsBoolean(EXCLUDE_GENERATED, false) == false) {
             if (createTime != null) {
                 builder.timeField(CREATE_TIME.getPreferredName(), CREATE_TIME.getPreferredName() + "_string", createTime.toEpochMilli());
             }

+ 3 - 3
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/TrainedModelConfig.java

@@ -47,7 +47,7 @@ import java.util.stream.Collectors;
 
 import static org.elasticsearch.action.ValidateActions.addValidationError;
 import static org.elasticsearch.xpack.core.ml.utils.NamedXContentObjectHelper.writeNamedObject;
-import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.FOR_EXPORT;
+import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
 
 
 public class TrainedModelConfig implements ToXContentObject, Writeable {
@@ -304,9 +304,9 @@ public class TrainedModelConfig implements ToXContentObject, Writeable {
     @Override
     public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
         builder.startObject();
+        builder.field(MODEL_ID.getPreferredName(), modelId);
         // If the model is to be exported for future import to another cluster, these fields are irrelevant.
-        if (params.paramAsBoolean(FOR_EXPORT, false) == false) {
-            builder.field(MODEL_ID.getPreferredName(), modelId);
+        if (params.paramAsBoolean(EXCLUDE_GENERATED, false) == false) {
             builder.field(CREATED_BY.getPreferredName(), createdBy);
             builder.field(VERSION.getPreferredName(), version.toString());
             builder.timeField(CREATE_TIME.getPreferredName(), CREATE_TIME.getPreferredName() + "_string", createTime.toEpochMilli());

+ 3 - 3
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/Job.java

@@ -42,7 +42,7 @@ import java.util.Set;
 import java.util.TreeSet;
 import java.util.concurrent.TimeUnit;
 
-import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.FOR_EXPORT;
+import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
 
 /**
  * This class represents a configured and created Job. The creation time is set
@@ -515,8 +515,8 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContentO
 
     public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {
         final String humanReadableSuffix = "_string";
-        if (params.paramAsBoolean(FOR_EXPORT, false) == false) {
-            builder.field(ID.getPreferredName(), jobId);
+        builder.field(ID.getPreferredName(), jobId);
+        if (params.paramAsBoolean(EXCLUDE_GENERATED, false) == false) {
             builder.field(JOB_TYPE.getPreferredName(), jobType);
             if (jobVersion != null) {
                 builder.field(JOB_VERSION.getPreferredName(), jobVersion);

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/ToXContentParams.java

@@ -24,7 +24,7 @@ public final class ToXContentParams {
      *
      * This helps to GET a configuration, copy it, and then PUT it directly without removing or changing any fields in between
      */
-    public static final String FOR_EXPORT = "for_export";
+    public static final String EXCLUDE_GENERATED = "exclude_generated";
 
     /**
      * When serialising POJOs to X Content this indicates whether the calculated (i.e. not stored) fields

+ 21 - 10
x-pack/plugin/ml/qa/basic-multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlBasicMultiNodeIT.java

@@ -15,6 +15,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.test.rest.ESRestTestCase;
 import org.yaml.snakeyaml.util.UriEncoder;
 
+import javax.print.attribute.standard.JobStateReason;
 import java.io.IOException;
 import java.io.UncheckedIOException;
 import java.util.Collections;
@@ -247,8 +248,9 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         String jobId = "test-export-import-job";
         createFarequoteJob(jobId);
         Response jobResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "anomaly_detectors/" + jobId + "?for_export=true"));
+            new Request("GET", BASE_PATH + "anomaly_detectors/" + jobId + "?exclude_generated=true"));
         Map<String, Object> originalJobBody = (Map<String, Object>)((List<?>) entityAsMap(jobResponse).get("jobs")).get(0);
+        originalJobBody.remove("job_id");
 
         XContentBuilder xContentBuilder = jsonBuilder().map(originalJobBody);
         Request request = new Request("PUT", BASE_PATH + "anomaly_detectors/" + jobId + "-import");
@@ -256,8 +258,9 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         client().performRequest(request);
 
         Response importedJobResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "anomaly_detectors/" + jobId + "-import" + "?for_export=true"));
+            new Request("GET", BASE_PATH + "anomaly_detectors/" + jobId + "-import" + "?exclude_generated=true"));
         Map<String, Object> importedJobBody = (Map<String, Object>)((List<?>) entityAsMap(importedJobResponse).get("jobs")).get(0);
+        importedJobBody.remove("job_id");
         assertThat(originalJobBody, equalTo(importedJobBody));
     }
 
@@ -270,8 +273,9 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         createDatafeed(datafeedId, jobId);
 
         Response dfResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "datafeeds/" + datafeedId + "?for_export=true"));
+            new Request("GET", BASE_PATH + "datafeeds/" + datafeedId + "?exclude_generated=true"));
         Map<String, Object> originalDfBody = (Map<String, Object>)((List<?>) entityAsMap(dfResponse).get("datafeeds")).get(0);
+        originalDfBody.remove("datafeed_id");
 
         //Delete this so we can PUT another datafeed for the same job
         client().performRequest(new Request("DELETE", BASE_PATH + "datafeeds/" + datafeedId));
@@ -284,8 +288,9 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         client().performRequest(request);
 
         Response importedDfResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "datafeeds/" + datafeedId + "-import" + "?for_export=true"));
+            new Request("GET", BASE_PATH + "datafeeds/" + datafeedId + "-import" + "?exclude_generated=true"));
         Map<String, Object> importedDfBody = (Map<String, Object>)((List<?>) entityAsMap(importedDfResponse).get("datafeeds")).get(0);
+        importedDfBody.remove("datafeed_id");
         assertThat(originalDfBody, equalTo(importedDfBody));
     }
 
@@ -325,8 +330,9 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         client().performRequest(request);
 
         Response jobResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "?for_export=true"));
+            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "?exclude_generated=true"));
         Map<String, Object> originalJobBody = (Map<String, Object>)((List<?>) entityAsMap(jobResponse).get("data_frame_analytics")).get(0);
+        originalJobBody.remove("id");
 
         XContentBuilder newBuilder = jsonBuilder().map(originalJobBody);
         request = new Request("PUT", BASE_PATH + "data_frame/analytics/" + analyticsId + "-import");
@@ -334,10 +340,11 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         client().performRequest(request);
 
         Response importedJobResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "-import" + "?for_export=true"));
+            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "-import" + "?exclude_generated=true"));
         Map<String, Object> importedJobBody = (Map<String, Object>)((List<?>) entityAsMap(importedJobResponse)
             .get("data_frame_analytics"))
             .get(0);
+        importedJobBody.remove("id");
         assertThat(originalJobBody, equalTo(importedJobBody));
     }
 
@@ -378,8 +385,9 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         client().performRequest(request);
 
         Response jobResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "?for_export=true"));
+            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "?exclude_generated=true"));
         Map<String, Object> originalJobBody = (Map<String, Object>)((List<?>) entityAsMap(jobResponse).get("data_frame_analytics")).get(0);
+        originalJobBody.remove("id");
 
         XContentBuilder newBuilder = jsonBuilder().map(originalJobBody);
         request = new Request("PUT", BASE_PATH + "data_frame/analytics/" + analyticsId + "-import");
@@ -387,10 +395,11 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         client().performRequest(request);
 
         Response importedJobResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "-import" + "?for_export=true"));
+            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "-import" + "?exclude_generated=true"));
         Map<String, Object> importedJobBody = (Map<String, Object>)((List<?>) entityAsMap(importedJobResponse)
             .get("data_frame_analytics"))
             .get(0);
+        importedJobBody.remove("id");
         assertThat(originalJobBody, equalTo(importedJobBody));
     }
 
@@ -431,8 +440,9 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         client().performRequest(request);
 
         Response jobResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "?for_export=true"));
+            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "?exclude_generated=true"));
         Map<String, Object> originalJobBody = (Map<String, Object>)((List<?>) entityAsMap(jobResponse).get("data_frame_analytics")).get(0);
+        originalJobBody.remove("id");
 
         XContentBuilder newBuilder = jsonBuilder().map(originalJobBody);
         request = new Request("PUT", BASE_PATH + "data_frame/analytics/" + analyticsId + "-import");
@@ -440,10 +450,11 @@ public class MlBasicMultiNodeIT extends ESRestTestCase {
         client().performRequest(request);
 
         Response importedJobResponse = client().performRequest(
-            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "-import" + "?for_export=true"));
+            new Request("GET", BASE_PATH + "data_frame/analytics/" + analyticsId + "-import" + "?exclude_generated=true"));
         Map<String, Object> importedJobBody = (Map<String, Object>)((List<?>) entityAsMap(importedJobResponse)
             .get("data_frame_analytics"))
             .get(0);
+        importedJobBody.remove("id");
         assertThat(originalJobBody, equalTo(importedJobBody));
     }
 

+ 2 - 1
x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/TrainedModelIT.java

@@ -204,11 +204,12 @@ public class TrainedModelIT extends ESRestTestCase {
         getModel = client().performRequest(new Request("GET",
             MachineLearning.BASE_PATH +
                 "trained_models/" + modelId +
-                "?include=definition&decompress_definition=false&for_export=true"));
+                "?include=definition&decompress_definition=false&exclude_generated=true"));
         assertThat(getModel.getStatusLine().getStatusCode(), equalTo(200));
 
         Map<String, Object> exportedModel = entityAsMap(getModel);
         Map<String, Object> modelDefinition = ((List<Map<String, Object>>)exportedModel.get("trained_model_configs")).get(0);
+        modelDefinition.remove("model_id");
 
         String importedModelId = "regression_model_to_import";
         try (XContentBuilder builder = XContentFactory.jsonBuilder()) {

+ 2 - 2
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java

@@ -21,7 +21,7 @@ import java.util.List;
 import java.util.Set;
 
 import static org.elasticsearch.rest.RestRequest.Method.GET;
-import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.FOR_EXPORT;
+import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
 
 public class RestGetDatafeedsAction extends BaseRestHandler {
 
@@ -57,6 +57,6 @@ public class RestGetDatafeedsAction extends BaseRestHandler {
 
     @Override
     protected Set<String> responseParams() {
-        return Collections.singleton(FOR_EXPORT);
+        return Collections.singleton(EXCLUDE_GENERATED);
     }
 }

+ 2 - 2
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/dataframe/RestGetDataFrameAnalyticsAction.java

@@ -21,7 +21,7 @@ import java.util.List;
 import java.util.Set;
 
 import static org.elasticsearch.rest.RestRequest.Method.GET;
-import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.FOR_EXPORT;
+import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
 
 public class RestGetDataFrameAnalyticsAction extends BaseRestHandler {
 
@@ -55,6 +55,6 @@ public class RestGetDataFrameAnalyticsAction extends BaseRestHandler {
 
     @Override
     protected Set<String> responseParams() {
-        return Collections.singleton(FOR_EXPORT);
+        return Collections.singleton(EXCLUDE_GENERATED);
     }
 }

+ 2 - 2
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/inference/RestGetTrainedModelsAction.java

@@ -34,7 +34,7 @@ import java.util.Set;
 import static java.util.Arrays.asList;
 import static org.elasticsearch.rest.RestRequest.Method.GET;
 import static org.elasticsearch.xpack.core.ml.action.GetTrainedModelsAction.Request.ALLOW_NO_MATCH;
-import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.FOR_EXPORT;
+import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
 
 public class RestGetTrainedModelsAction extends BaseRestHandler {
 
@@ -99,7 +99,7 @@ public class RestGetTrainedModelsAction extends BaseRestHandler {
 
     @Override
     protected Set<String> responseParams() {
-        return Set.of(TrainedModelConfig.DECOMPRESS_DEFINITION, FOR_EXPORT);
+        return Set.of(TrainedModelConfig.DECOMPRESS_DEFINITION, EXCLUDE_GENERATED);
     }
 
     private static class RestToXContentListenerWithDefaultValues<T extends ToXContentObject> extends RestToXContentListener<T> {

+ 2 - 2
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java

@@ -23,7 +23,7 @@ import java.util.List;
 import java.util.Set;
 
 import static org.elasticsearch.rest.RestRequest.Method.GET;
-import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.FOR_EXPORT;
+import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
 
 public class RestGetJobsAction extends BaseRestHandler {
 
@@ -59,6 +59,6 @@ public class RestGetJobsAction extends BaseRestHandler {
 
     @Override
     protected Set<String> responseParams() {
-        return Collections.singleton(FOR_EXPORT);
+        return Collections.singleton(EXCLUDE_GENERATED);
     }
 }

+ 1 - 1
x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_data_frame_analytics.json

@@ -44,7 +44,7 @@
         "description":"specifies a max number of analytics to get",
         "default":100
       },
-      "for_export": {
+      "exclude_generated": {
         "required": false,
         "type": "boolean",
         "default": false,

+ 1 - 1
x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_datafeeds.json

@@ -39,7 +39,7 @@
         "description":"Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)",
         "deprecated":true
       },
-      "for_export": {
+      "exclude_generated": {
         "required": false,
         "type": "boolean",
         "default": false,

+ 1 - 1
x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_jobs.json

@@ -39,7 +39,7 @@
         "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)",
         "deprecated":true
       },
-      "for_export": {
+      "exclude_generated": {
         "required": false,
         "type": "boolean",
         "default": false,

+ 1 - 1
x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_trained_models.json

@@ -69,7 +69,7 @@
         "type":"list",
         "description":"A comma-separated list of tags that the model must have."
       },
-      "for_export": {
+      "exclude_generated": {
         "required": false,
         "type": "boolean",
         "default": false,

+ 1 - 2
x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml

@@ -2188,7 +2188,7 @@ setup:
   - do:
       ml.get_data_frame_analytics:
         id: "simple-outlier-detection"
-        for_export: true
+        exclude_generated: true
   - match: { data_frame_analytics.0.source.index.0: "index-source" }
   - match: { data_frame_analytics.0.source.query: {"match_all" : {} } }
   - match: { data_frame_analytics.0.dest.index: "index-dest" }
@@ -2201,4 +2201,3 @@ setup:
   }}
   - is_false: data_frame_analytics.0.create_time
   - is_false: data_frame_analytics.0.version
-  - is_false: data_frame_analytics.0.id

+ 1 - 3
x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml

@@ -519,10 +519,8 @@ setup:
   - do:
       ml.get_datafeeds:
         datafeed_id: test-for-export
-        for_export: true
+        exclude_generated: true
   - match: { datafeeds.0.indices.0: "index-foo"}
-  - is_false: datafeeds.0.datafeed_id
-  - is_false: datafeeds.0.job_id
   - is_false: datafeeds.0.create_time
   - is_false: datafeeds.0.query_delay
   - is_false: datafeeds.0.chunking_config

+ 3 - 3
x-pack/plugin/src/test/resources/rest-api-spec/test/ml/inference_crud.yml

@@ -854,20 +854,20 @@ setup:
             }
           }
 ---
-"Test for_export flag":
+"Test exclude_generated flag":
   - do:
       ml.get_trained_models:
         model_id: "a-regression-model-1"
-        for_export: true
+        exclude_generated: true
         include: "definition"
         decompress_definition: false
 
   - match: { trained_model_configs.0.description: "empty model for tests" }
+  - match: { trained_model_configs.0.model_id: "a-regression-model-1" }
   - is_true:  trained_model_configs.0.compressed_definition
   - is_true:  trained_model_configs.0.input
   - is_true:  trained_model_configs.0.inference_config
   - is_true:  trained_model_configs.0.tags
-  - is_false: trained_model_configs.0.model_id
   - is_false: trained_model_configs.0.created_by
   - is_false: trained_model_configs.0.version
   - is_false: trained_model_configs.0.create_time

+ 1 - 2
x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get.yml

@@ -92,9 +92,8 @@ setup:
   - do:
       ml.get_jobs:
         job_id: jobs-get-1
-        for_export: true
+        exclude_generated: true
   - match: { jobs.0.description: "Job 1"}
-  - is_false: job_id
   - is_false: job_type
   - is_false: job_version
   - is_false: create_time