From 6b70aa7b28879fa4aa34c14571cc46e88dedc529 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Tue, 11 Feb 2020 13:31:20 +0200 Subject: [PATCH 1/6] [ML] Rename data frame analytics maximum_number_trees to max_trees Deprecates `maximum_number_trees` parameter of classification and regression and replaces it with `max_trees`. --- .../client/ml/dataframe/Classification.java | 30 +++++++------- .../client/ml/dataframe/Regression.java | 30 +++++++------- .../client/MachineLearningIT.java | 4 +- .../MlClientDocumentationIT.java | 4 +- .../ml/dataframe/ClassificationTests.java | 2 +- .../client/ml/dataframe/RegressionTests.java | 2 +- .../apis/put-dfanalytics.asciidoc | 8 ++-- docs/reference/ml/ml-shared.asciidoc | 4 +- .../dataframe/analyses/BoostedTreeParams.java | 40 +++++++++---------- .../ml/job/results/ReservedFieldNames.java | 2 +- .../xpack/core/ml/config_index_mappings.json | 4 +- .../analyses/BoostedTreeParamsTests.java | 10 ++--- .../ml/integration/ClassificationIT.java | 2 +- .../xpack/ml/integration/RegressionIT.java | 2 +- 14 files changed, 72 insertions(+), 72 deletions(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/dataframe/Classification.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/dataframe/Classification.java index 02861adc73845..6fc533c0f722e 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/dataframe/Classification.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/dataframe/Classification.java @@ -44,7 +44,7 @@ public static Builder builder(String dependentVariable) { static final ParseField LAMBDA = new ParseField("lambda"); static final ParseField GAMMA = new ParseField("gamma"); static final ParseField ETA = new ParseField("eta"); - static final ParseField MAXIMUM_NUMBER_TREES = new ParseField("maximum_number_trees"); + static final ParseField MAX_TREES = new ParseField("max_trees"); static final ParseField FEATURE_BAG_FRACTION = new ParseField("feature_bag_fraction"); static final ParseField NUM_TOP_FEATURE_IMPORTANCE_VALUES = new ParseField("num_top_feature_importance_values"); static final ParseField PREDICTION_FIELD_NAME = new ParseField("prediction_field_name"); @@ -74,7 +74,7 @@ public static Builder builder(String dependentVariable) { PARSER.declareDouble(ConstructingObjectParser.optionalConstructorArg(), LAMBDA); PARSER.declareDouble(ConstructingObjectParser.optionalConstructorArg(), GAMMA); PARSER.declareDouble(ConstructingObjectParser.optionalConstructorArg(), ETA); - PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), MAXIMUM_NUMBER_TREES); + PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), MAX_TREES); PARSER.declareDouble(ConstructingObjectParser.optionalConstructorArg(), FEATURE_BAG_FRACTION); PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), NUM_TOP_FEATURE_IMPORTANCE_VALUES); PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), PREDICTION_FIELD_NAME); @@ -87,7 +87,7 @@ public static Builder builder(String dependentVariable) { private final Double lambda; private final Double gamma; private final Double eta; - private final Integer maximumNumberTrees; + private final Integer maxTrees; private final Double featureBagFraction; private final Integer numTopFeatureImportanceValues; private final String predictionFieldName; @@ -96,14 +96,14 @@ public static Builder builder(String dependentVariable) { private final Long randomizeSeed; private Classification(String dependentVariable, @Nullable Double lambda, @Nullable Double gamma, @Nullable Double eta, - @Nullable Integer maximumNumberTrees, @Nullable Double featureBagFraction, + @Nullable Integer maxTrees, @Nullable Double featureBagFraction, @Nullable Integer numTopFeatureImportanceValues, @Nullable String predictionFieldName, @Nullable Double trainingPercent, @Nullable Integer numTopClasses, @Nullable Long randomizeSeed) { this.dependentVariable = Objects.requireNonNull(dependentVariable); this.lambda = lambda; this.gamma = gamma; this.eta = eta; - this.maximumNumberTrees = maximumNumberTrees; + this.maxTrees = maxTrees; this.featureBagFraction = featureBagFraction; this.numTopFeatureImportanceValues = numTopFeatureImportanceValues; this.predictionFieldName = predictionFieldName; @@ -133,8 +133,8 @@ public Double getEta() { return eta; } - public Integer getMaximumNumberTrees() { - return maximumNumberTrees; + public Integer getMaxTrees() { + return maxTrees; } public Double getFeatureBagFraction() { @@ -174,8 +174,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (eta != null) { builder.field(ETA.getPreferredName(), eta); } - if (maximumNumberTrees != null) { - builder.field(MAXIMUM_NUMBER_TREES.getPreferredName(), maximumNumberTrees); + if (maxTrees != null) { + builder.field(MAX_TREES.getPreferredName(), maxTrees); } if (featureBagFraction != null) { builder.field(FEATURE_BAG_FRACTION.getPreferredName(), featureBagFraction); @@ -201,7 +201,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws @Override public int hashCode() { - return Objects.hash(dependentVariable, lambda, gamma, eta, maximumNumberTrees, featureBagFraction, numTopFeatureImportanceValues, + return Objects.hash(dependentVariable, lambda, gamma, eta, maxTrees, featureBagFraction, numTopFeatureImportanceValues, predictionFieldName, trainingPercent, randomizeSeed, numTopClasses); } @@ -214,7 +214,7 @@ public boolean equals(Object o) { && Objects.equals(lambda, that.lambda) && Objects.equals(gamma, that.gamma) && Objects.equals(eta, that.eta) - && Objects.equals(maximumNumberTrees, that.maximumNumberTrees) + && Objects.equals(maxTrees, that.maxTrees) && Objects.equals(featureBagFraction, that.featureBagFraction) && Objects.equals(numTopFeatureImportanceValues, that.numTopFeatureImportanceValues) && Objects.equals(predictionFieldName, that.predictionFieldName) @@ -233,7 +233,7 @@ public static class Builder { private Double lambda; private Double gamma; private Double eta; - private Integer maximumNumberTrees; + private Integer maxTrees; private Double featureBagFraction; private Integer numTopFeatureImportanceValues; private String predictionFieldName; @@ -260,8 +260,8 @@ public Builder setEta(Double eta) { return this; } - public Builder setMaximumNumberTrees(Integer maximumNumberTrees) { - this.maximumNumberTrees = maximumNumberTrees; + public Builder setMaxTrees(Integer maxTrees) { + this.maxTrees = maxTrees; return this; } @@ -296,7 +296,7 @@ public Builder setNumTopClasses(Integer numTopClasses) { } public Classification build() { - return new Classification(dependentVariable, lambda, gamma, eta, maximumNumberTrees, featureBagFraction, + return new Classification(dependentVariable, lambda, gamma, eta, maxTrees, featureBagFraction, numTopFeatureImportanceValues, predictionFieldName, trainingPercent, numTopClasses, randomizeSeed); } } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/dataframe/Regression.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/dataframe/Regression.java index d7e374a2563a1..7eb1af3405486 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/dataframe/Regression.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ml/dataframe/Regression.java @@ -44,7 +44,7 @@ public static Builder builder(String dependentVariable) { static final ParseField LAMBDA = new ParseField("lambda"); static final ParseField GAMMA = new ParseField("gamma"); static final ParseField ETA = new ParseField("eta"); - static final ParseField MAXIMUM_NUMBER_TREES = new ParseField("maximum_number_trees"); + static final ParseField MAX_TREES = new ParseField("max_trees"); static final ParseField FEATURE_BAG_FRACTION = new ParseField("feature_bag_fraction"); static final ParseField NUM_TOP_FEATURE_IMPORTANCE_VALUES = new ParseField("num_top_feature_importance_values"); static final ParseField PREDICTION_FIELD_NAME = new ParseField("prediction_field_name"); @@ -72,7 +72,7 @@ public static Builder builder(String dependentVariable) { PARSER.declareDouble(ConstructingObjectParser.optionalConstructorArg(), LAMBDA); PARSER.declareDouble(ConstructingObjectParser.optionalConstructorArg(), GAMMA); PARSER.declareDouble(ConstructingObjectParser.optionalConstructorArg(), ETA); - PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), MAXIMUM_NUMBER_TREES); + PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), MAX_TREES); PARSER.declareDouble(ConstructingObjectParser.optionalConstructorArg(), FEATURE_BAG_FRACTION); PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), NUM_TOP_FEATURE_IMPORTANCE_VALUES); PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), PREDICTION_FIELD_NAME); @@ -84,7 +84,7 @@ public static Builder builder(String dependentVariable) { private final Double lambda; private final Double gamma; private final Double eta; - private final Integer maximumNumberTrees; + private final Integer maxTrees; private final Double featureBagFraction; private final Integer numTopFeatureImportanceValues; private final String predictionFieldName; @@ -92,14 +92,14 @@ public static Builder builder(String dependentVariable) { private final Long randomizeSeed; private Regression(String dependentVariable, @Nullable Double lambda, @Nullable Double gamma, @Nullable Double eta, - @Nullable Integer maximumNumberTrees, @Nullable Double featureBagFraction, + @Nullable Integer maxTrees, @Nullable Double featureBagFraction, @Nullable Integer numTopFeatureImportanceValues, @Nullable String predictionFieldName, @Nullable Double trainingPercent, @Nullable Long randomizeSeed) { this.dependentVariable = Objects.requireNonNull(dependentVariable); this.lambda = lambda; this.gamma = gamma; this.eta = eta; - this.maximumNumberTrees = maximumNumberTrees; + this.maxTrees = maxTrees; this.featureBagFraction = featureBagFraction; this.numTopFeatureImportanceValues = numTopFeatureImportanceValues; this.predictionFieldName = predictionFieldName; @@ -128,8 +128,8 @@ public Double getEta() { return eta; } - public Integer getMaximumNumberTrees() { - return maximumNumberTrees; + public Integer getMaxTrees() { + return maxTrees; } public Double getFeatureBagFraction() { @@ -165,8 +165,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (eta != null) { builder.field(ETA.getPreferredName(), eta); } - if (maximumNumberTrees != null) { - builder.field(MAXIMUM_NUMBER_TREES.getPreferredName(), maximumNumberTrees); + if (maxTrees != null) { + builder.field(MAX_TREES.getPreferredName(), maxTrees); } if (featureBagFraction != null) { builder.field(FEATURE_BAG_FRACTION.getPreferredName(), featureBagFraction); @@ -189,7 +189,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws @Override public int hashCode() { - return Objects.hash(dependentVariable, lambda, gamma, eta, maximumNumberTrees, featureBagFraction, numTopFeatureImportanceValues, + return Objects.hash(dependentVariable, lambda, gamma, eta, maxTrees, featureBagFraction, numTopFeatureImportanceValues, predictionFieldName, trainingPercent, randomizeSeed); } @@ -202,7 +202,7 @@ public boolean equals(Object o) { && Objects.equals(lambda, that.lambda) && Objects.equals(gamma, that.gamma) && Objects.equals(eta, that.eta) - && Objects.equals(maximumNumberTrees, that.maximumNumberTrees) + && Objects.equals(maxTrees, that.maxTrees) && Objects.equals(featureBagFraction, that.featureBagFraction) && Objects.equals(numTopFeatureImportanceValues, that.numTopFeatureImportanceValues) && Objects.equals(predictionFieldName, that.predictionFieldName) @@ -220,7 +220,7 @@ public static class Builder { private Double lambda; private Double gamma; private Double eta; - private Integer maximumNumberTrees; + private Integer maxTrees; private Double featureBagFraction; private Integer numTopFeatureImportanceValues; private String predictionFieldName; @@ -246,8 +246,8 @@ public Builder setEta(Double eta) { return this; } - public Builder setMaximumNumberTrees(Integer maximumNumberTrees) { - this.maximumNumberTrees = maximumNumberTrees; + public Builder setMaxTrees(Integer maxTrees) { + this.maxTrees = maxTrees; return this; } @@ -277,7 +277,7 @@ public Builder setRandomizeSeed(Long randomizeSeed) { } public Regression build() { - return new Regression(dependentVariable, lambda, gamma, eta, maximumNumberTrees, featureBagFraction, + return new Regression(dependentVariable, lambda, gamma, eta, maxTrees, featureBagFraction, numTopFeatureImportanceValues, predictionFieldName, trainingPercent, randomizeSeed); } } 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 3e9cc1f55ff38..2f923abf04983 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 @@ -1297,7 +1297,7 @@ public void testPutDataFrameAnalyticsConfig_GivenRegression() throws Exception { .setLambda(1.0) .setGamma(1.0) .setEta(1.0) - .setMaximumNumberTrees(10) + .setMaxTrees(10) .setFeatureBagFraction(0.5) .setNumTopFeatureImportanceValues(3) .build()) @@ -1340,7 +1340,7 @@ public void testPutDataFrameAnalyticsConfig_GivenClassification() throws Excepti .setLambda(1.0) .setGamma(1.0) .setEta(1.0) - .setMaximumNumberTrees(10) + .setMaxTrees(10) .setFeatureBagFraction(0.5) .setNumTopFeatureImportanceValues(3) .build()) 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 d1c3a5e657e0f..74e34889897e3 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 @@ -2973,7 +2973,7 @@ public void testPutDataFrameAnalytics() throws Exception { .setLambda(1.0) // <2> .setGamma(5.5) // <3> .setEta(5.5) // <4> - .setMaximumNumberTrees(50) // <5> + .setMaxTrees(50) // <5> .setFeatureBagFraction(0.4) // <6> .setNumTopFeatureImportanceValues(3) // <7> .setPredictionFieldName("my_prediction_field_name") // <8> @@ -2988,7 +2988,7 @@ public void testPutDataFrameAnalytics() throws Exception { .setLambda(1.0) // <2> .setGamma(5.5) // <3> .setEta(5.5) // <4> - .setMaximumNumberTrees(50) // <5> + .setMaxTrees(50) // <5> .setFeatureBagFraction(0.4) // <6> .setNumTopFeatureImportanceValues(3) // <7> .setPredictionFieldName("my_prediction_field_name") // <8> diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/dataframe/ClassificationTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/dataframe/ClassificationTests.java index 79d78c888880f..906003e200975 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/dataframe/ClassificationTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/dataframe/ClassificationTests.java @@ -30,7 +30,7 @@ public static Classification randomClassification() { .setLambda(randomBoolean() ? null : randomDoubleBetween(0.0, Double.MAX_VALUE, true)) .setGamma(randomBoolean() ? null : randomDoubleBetween(0.0, Double.MAX_VALUE, true)) .setEta(randomBoolean() ? null : randomDoubleBetween(0.001, 1.0, true)) - .setMaximumNumberTrees(randomBoolean() ? null : randomIntBetween(1, 2000)) + .setMaxTrees(randomBoolean() ? null : randomIntBetween(1, 2000)) .setFeatureBagFraction(randomBoolean() ? null : randomDoubleBetween(0.0, 1.0, false)) .setNumTopFeatureImportanceValues(randomBoolean() ? null : randomIntBetween(0, Integer.MAX_VALUE)) .setPredictionFieldName(randomBoolean() ? null : randomAlphaOfLength(10)) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/dataframe/RegressionTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/dataframe/RegressionTests.java index eedffb4740d78..1b81f1d0f71af 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/dataframe/RegressionTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/dataframe/RegressionTests.java @@ -30,7 +30,7 @@ public static Regression randomRegression() { .setLambda(randomBoolean() ? null : randomDoubleBetween(0.0, Double.MAX_VALUE, true)) .setGamma(randomBoolean() ? null : randomDoubleBetween(0.0, Double.MAX_VALUE, true)) .setEta(randomBoolean() ? null : randomDoubleBetween(0.001, 1.0, true)) - .setMaximumNumberTrees(randomBoolean() ? null : randomIntBetween(1, 2000)) + .setMaxTrees(randomBoolean() ? null : randomIntBetween(1, 2000)) .setFeatureBagFraction(randomBoolean() ? null : randomDoubleBetween(0.0, 1.0, false)) .setNumTopFeatureImportanceValues(randomBoolean() ? null : randomIntBetween(0, Integer.MAX_VALUE)) .setPredictionFieldName(randomBoolean() ? null : randomAlphaOfLength(10)) diff --git a/docs/reference/ml/df-analytics/apis/put-dfanalytics.asciidoc b/docs/reference/ml/df-analytics/apis/put-dfanalytics.asciidoc index d9087a6dac51b..2a3822b0ee888 100644 --- a/docs/reference/ml/df-analytics/apis/put-dfanalytics.asciidoc +++ b/docs/reference/ml/df-analytics/apis/put-dfanalytics.asciidoc @@ -124,9 +124,9 @@ include::{docdir}/ml/ml-shared.asciidoc[tag=eta] (Optional, double) include::{docdir}/ml/ml-shared.asciidoc[tag=feature-bag-fraction] -`analysis`.`classification`.`maximum_number_trees`:::: +`analysis`.`classification`.`max_trees`:::: (Optional, integer) -include::{docdir}/ml/ml-shared.asciidoc[tag=maximum-number-trees] +include::{docdir}/ml/ml-shared.asciidoc[tag=max-trees] `analysis`.`classification`.`gamma`:::: (Optional, double) @@ -218,9 +218,9 @@ include::{docdir}/ml/ml-shared.asciidoc[tag=eta] (Optional, double) include::{docdir}/ml/ml-shared.asciidoc[tag=feature-bag-fraction] -`analysis`.`regression`.`maximum_number_trees`:::: +`analysis`.`regression`.`max_trees`:::: (Optional, integer) -include::{docdir}/ml/ml-shared.asciidoc[tag=maximum-number-trees] +include::{docdir}/ml/ml-shared.asciidoc[tag=max-trees] `analysis`.`regression`.`gamma`:::: (Optional, double) diff --git a/docs/reference/ml/ml-shared.asciidoc b/docs/reference/ml/ml-shared.asciidoc index ce0a06174a24a..ad2e37d98e485 100644 --- a/docs/reference/ml/ml-shared.asciidoc +++ b/docs/reference/ml/ml-shared.asciidoc @@ -946,10 +946,10 @@ remain started until it is explicitly stopped. By default this setting is not set. end::max-empty-searches[] -tag::maximum-number-trees[] +tag::max-trees[] Advanced configuration option. Defines the maximum number of trees the forest is allowed to contain. The maximum value is 2000. -end::maximum-number-trees[] +end::max-trees[] tag::memory-estimation[] An object containing the memory estimates. The object has the diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/analyses/BoostedTreeParams.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/analyses/BoostedTreeParams.java index 04ced8a2f4c06..664162bb80cb4 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/analyses/BoostedTreeParams.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/analyses/BoostedTreeParams.java @@ -33,7 +33,7 @@ public class BoostedTreeParams implements ToXContentFragment, Writeable { public static final ParseField LAMBDA = new ParseField("lambda"); public static final ParseField GAMMA = new ParseField("gamma"); public static final ParseField ETA = new ParseField("eta"); - public static final ParseField MAXIMUM_NUMBER_TREES = new ParseField("maximum_number_trees"); + public static final ParseField MAX_TREES = new ParseField("max_trees", "maximum_number_trees"); public static final ParseField FEATURE_BAG_FRACTION = new ParseField("feature_bag_fraction"); public static final ParseField NUM_TOP_FEATURE_IMPORTANCE_VALUES = new ParseField("num_top_feature_importance_values"); @@ -41,7 +41,7 @@ static void declareFields(AbstractObjectParser parser) { parser.declareDouble(optionalConstructorArg(), LAMBDA); parser.declareDouble(optionalConstructorArg(), GAMMA); parser.declareDouble(optionalConstructorArg(), ETA); - parser.declareInt(optionalConstructorArg(), MAXIMUM_NUMBER_TREES); + parser.declareInt(optionalConstructorArg(), MAX_TREES); parser.declareDouble(optionalConstructorArg(), FEATURE_BAG_FRACTION); parser.declareInt(optionalConstructorArg(), NUM_TOP_FEATURE_IMPORTANCE_VALUES); } @@ -49,14 +49,14 @@ static void declareFields(AbstractObjectParser parser) { private final Double lambda; private final Double gamma; private final Double eta; - private final Integer maximumNumberTrees; + private final Integer maxTrees; private final Double featureBagFraction; private final Integer numTopFeatureImportanceValues; public BoostedTreeParams(@Nullable Double lambda, @Nullable Double gamma, @Nullable Double eta, - @Nullable Integer maximumNumberTrees, + @Nullable Integer maxTrees, @Nullable Double featureBagFraction, @Nullable Integer numTopFeatureImportanceValues) { if (lambda != null && lambda < 0) { @@ -68,8 +68,8 @@ public BoostedTreeParams(@Nullable Double lambda, if (eta != null && (eta < 0.001 || eta > 1)) { throw ExceptionsHelper.badRequestException("[{}] must be a double in [0.001, 1]", ETA.getPreferredName()); } - if (maximumNumberTrees != null && (maximumNumberTrees <= 0 || maximumNumberTrees > 2000)) { - throw ExceptionsHelper.badRequestException("[{}] must be an integer in [1, 2000]", MAXIMUM_NUMBER_TREES.getPreferredName()); + if (maxTrees != null && (maxTrees <= 0 || maxTrees > 2000)) { + throw ExceptionsHelper.badRequestException("[{}] must be an integer in [1, 2000]", MAX_TREES.getPreferredName()); } if (featureBagFraction != null && (featureBagFraction <= 0 || featureBagFraction > 1.0)) { throw ExceptionsHelper.badRequestException("[{}] must be a double in (0, 1]", FEATURE_BAG_FRACTION.getPreferredName()); @@ -81,7 +81,7 @@ public BoostedTreeParams(@Nullable Double lambda, this.lambda = lambda; this.gamma = gamma; this.eta = eta; - this.maximumNumberTrees = maximumNumberTrees; + this.maxTrees = maxTrees; this.featureBagFraction = featureBagFraction; this.numTopFeatureImportanceValues = numTopFeatureImportanceValues; } @@ -90,7 +90,7 @@ public BoostedTreeParams(@Nullable Double lambda, lambda = in.readOptionalDouble(); gamma = in.readOptionalDouble(); eta = in.readOptionalDouble(); - maximumNumberTrees = in.readOptionalVInt(); + maxTrees = in.readOptionalVInt(); featureBagFraction = in.readOptionalDouble(); if (in.getVersion().onOrAfter(Version.V_7_6_0)) { numTopFeatureImportanceValues = in.readOptionalInt(); @@ -104,7 +104,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalDouble(lambda); out.writeOptionalDouble(gamma); out.writeOptionalDouble(eta); - out.writeOptionalVInt(maximumNumberTrees); + out.writeOptionalVInt(maxTrees); out.writeOptionalDouble(featureBagFraction); if (out.getVersion().onOrAfter(Version.V_7_6_0)) { out.writeOptionalInt(numTopFeatureImportanceValues); @@ -122,8 +122,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (eta != null) { builder.field(ETA.getPreferredName(), eta); } - if (maximumNumberTrees != null) { - builder.field(MAXIMUM_NUMBER_TREES.getPreferredName(), maximumNumberTrees); + if (maxTrees != null) { + builder.field(MAX_TREES.getPreferredName(), maxTrees); } if (featureBagFraction != null) { builder.field(FEATURE_BAG_FRACTION.getPreferredName(), featureBagFraction); @@ -145,8 +145,8 @@ Map getParams() { if (eta != null) { params.put(ETA.getPreferredName(), eta); } - if (maximumNumberTrees != null) { - params.put(MAXIMUM_NUMBER_TREES.getPreferredName(), maximumNumberTrees); + if (maxTrees != null) { + params.put(MAX_TREES.getPreferredName(), maxTrees); } if (featureBagFraction != null) { params.put(FEATURE_BAG_FRACTION.getPreferredName(), featureBagFraction); @@ -165,14 +165,14 @@ public boolean equals(Object o) { return Objects.equals(lambda, that.lambda) && Objects.equals(gamma, that.gamma) && Objects.equals(eta, that.eta) - && Objects.equals(maximumNumberTrees, that.maximumNumberTrees) + && Objects.equals(maxTrees, that.maxTrees) && Objects.equals(featureBagFraction, that.featureBagFraction) && Objects.equals(numTopFeatureImportanceValues, that.numTopFeatureImportanceValues); } @Override public int hashCode() { - return Objects.hash(lambda, gamma, eta, maximumNumberTrees, featureBagFraction, numTopFeatureImportanceValues); + return Objects.hash(lambda, gamma, eta, maxTrees, featureBagFraction, numTopFeatureImportanceValues); } public static Builder builder() { @@ -184,7 +184,7 @@ public static class Builder { private Double lambda; private Double gamma; private Double eta; - private Integer maximumNumberTrees; + private Integer maxTrees; private Double featureBagFraction; private Integer numTopFeatureImportanceValues; @@ -194,7 +194,7 @@ private Builder() {} this.lambda = params.lambda; this.gamma = params.gamma; this.eta = params.eta; - this.maximumNumberTrees = params.maximumNumberTrees; + this.maxTrees = params.maxTrees; this.featureBagFraction = params.featureBagFraction; this.numTopFeatureImportanceValues = params.numTopFeatureImportanceValues; } @@ -214,8 +214,8 @@ public Builder setEta(Double eta) { return this; } - public Builder setMaximumNumberTrees(Integer maximumNumberTrees) { - this.maximumNumberTrees = maximumNumberTrees; + public Builder setMaxTrees(Integer maxTrees) { + this.maxTrees = maxTrees; return this; } @@ -230,7 +230,7 @@ public Builder setNumTopFeatureImportanceValues(Integer numTopFeatureImportanceV } public BoostedTreeParams build() { - return new BoostedTreeParams(lambda, gamma, eta, maximumNumberTrees, featureBagFraction, numTopFeatureImportanceValues); + return new BoostedTreeParams(lambda, gamma, eta, maxTrees, featureBagFraction, numTopFeatureImportanceValues); } } } 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 9ae1aa2957adf..b4a8054cca85a 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 @@ -322,7 +322,7 @@ public final class ReservedFieldNames { BoostedTreeParams.LAMBDA.getPreferredName(), BoostedTreeParams.GAMMA.getPreferredName(), BoostedTreeParams.ETA.getPreferredName(), - BoostedTreeParams.MAXIMUM_NUMBER_TREES.getPreferredName(), + BoostedTreeParams.MAX_TREES.getPreferredName(), BoostedTreeParams.FEATURE_BAG_FRACTION.getPreferredName(), BoostedTreeParams.NUM_TOP_FEATURE_IMPORTANCE_VALUES.getPreferredName(), diff --git a/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json b/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json index 1abd7e42e8ad1..5ee5957e49331 100644 --- a/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json +++ b/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json @@ -40,7 +40,7 @@ "lambda" : { "type" : "double" }, - "maximum_number_trees" : { + "max_trees" : { "type" : "integer" }, "num_top_classes" : { @@ -87,7 +87,7 @@ "lambda" : { "type" : "double" }, - "maximum_number_trees" : { + "max_trees" : { "type" : "integer" }, "num_top_feature_importance_values" : { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/dataframe/analyses/BoostedTreeParamsTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/dataframe/analyses/BoostedTreeParamsTests.java index 7f9d8c243e50b..f1114bf3445a8 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/dataframe/analyses/BoostedTreeParamsTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/dataframe/analyses/BoostedTreeParamsTests.java @@ -39,7 +39,7 @@ public static BoostedTreeParams createRandom() { .setLambda(randomBoolean() ? null : randomDoubleBetween(0.0, Double.MAX_VALUE, true)) .setGamma(randomBoolean() ? null : randomDoubleBetween(0.0, Double.MAX_VALUE, true)) .setEta(randomBoolean() ? null : randomDoubleBetween(0.001, 1.0, true)) - .setMaximumNumberTrees(randomBoolean() ? null : randomIntBetween(1, 2000)) + .setMaxTrees(randomBoolean() ? null : randomIntBetween(1, 2000)) .setFeatureBagFraction(randomBoolean() ? null : randomDoubleBetween(0.0, 1.0, false)) .setNumTopFeatureImportanceValues(randomBoolean() ? null : randomIntBetween(0, Integer.MAX_VALUE)) .build(); @@ -88,16 +88,16 @@ public void testConstructor_GivenEtaIsGreaterThanOne() { public void testConstructor_GivenMaximumNumberTreesIsZero() { ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, - () -> BoostedTreeParams.builder().setMaximumNumberTrees(0).build()); + () -> BoostedTreeParams.builder().setMaxTrees(0).build()); - assertThat(e.getMessage(), equalTo("[maximum_number_trees] must be an integer in [1, 2000]")); + assertThat(e.getMessage(), equalTo("[max_trees] must be an integer in [1, 2000]")); } public void testConstructor_GivenMaximumNumberTreesIsGreaterThan2k() { ElasticsearchStatusException e = expectThrows(ElasticsearchStatusException.class, - () -> BoostedTreeParams.builder().setMaximumNumberTrees(2001).build()); + () -> BoostedTreeParams.builder().setMaxTrees(2001).build()); - assertThat(e.getMessage(), equalTo("[maximum_number_trees] must be an integer in [1, 2000]")); + assertThat(e.getMessage(), equalTo("[max_trees] must be an integer in [1, 2000]")); } public void testConstructor_GivenFeatureBagFractionIsLessThanZero() { diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java index 6447ff0287bbb..f143188e306c5 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ClassificationIT.java @@ -435,7 +435,7 @@ public void testTwoJobsWithSameRandomizeSeedUseSameTrainingSet() throws Exceptio .setGamma(1.0) .setEta(1.0) .setFeatureBagFraction(1.0) - .setMaximumNumberTrees(1) + .setMaxTrees(1) .build(); DataFrameAnalyticsConfig firstJob = buildAnalytics(firstJobId, sourceIndex, firstJobDestIndex, null, diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java index bce5e2355fd71..fc918df9e6429 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/RegressionIT.java @@ -282,7 +282,7 @@ public void testTwoJobsWithSameRandomizeSeedUseSameTrainingSet() throws Exceptio .setGamma(1.0) .setEta(1.0) .setFeatureBagFraction(1.0) - .setMaximumNumberTrees(1) + .setMaxTrees(1) .build(); DataFrameAnalyticsConfig firstJob = buildAnalytics(firstJobId, sourceIndex, firstJobDestIndex, null, From 0bb6d7d3256d93f87cd4835482d5ef53c8a10ad9 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Mon, 9 Mar 2020 20:30:18 +0200 Subject: [PATCH 2/6] Preserve deprecated name in mappings --- .../xpack/core/ml/job/results/ReservedFieldNames.java | 1 + .../elasticsearch/xpack/core/ml/config_index_mappings.json | 6 ++++++ 2 files changed, 7 insertions(+) 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 b4a8054cca85a..a325be166a88b 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 @@ -322,6 +322,7 @@ public final class ReservedFieldNames { BoostedTreeParams.LAMBDA.getPreferredName(), BoostedTreeParams.GAMMA.getPreferredName(), BoostedTreeParams.ETA.getPreferredName(), + "maximum_number_trees", BoostedTreeParams.MAX_TREES.getPreferredName(), BoostedTreeParams.FEATURE_BAG_FRACTION.getPreferredName(), BoostedTreeParams.NUM_TOP_FEATURE_IMPORTANCE_VALUES.getPreferredName(), diff --git a/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json b/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json index 5ee5957e49331..9098ff084afc2 100644 --- a/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json +++ b/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json @@ -40,6 +40,9 @@ "lambda" : { "type" : "double" }, + "maximum_number_trees" : { + "type" : "integer" + }, "max_trees" : { "type" : "integer" }, @@ -87,6 +90,9 @@ "lambda" : { "type" : "double" }, + "maximum_number_trees" : { + "type" : "integer" + }, "max_trees" : { "type" : "integer" }, From f312c408457bcb1e6ba53e59cbe3b826458ea0bb Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Tue, 10 Mar 2020 10:47:56 +0200 Subject: [PATCH 3/6] Fix YAML tests and add test using deprecated field name --- .../test/ml/data_frame_analytics_crud.yml | 83 ++++++++++++++----- 1 file changed, 63 insertions(+), 20 deletions(-) diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml index df394a85f0995..8884941ddfa98 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml @@ -1333,12 +1333,12 @@ setup: } --- -"Test put regression given maximum_number_trees is zero": +"Test put regression given max_trees is zero": - do: - catch: /\[maximum_number_trees\] must be an integer in \[1, 2000\]/ + catch: /\[max_trees\] must be an integer in \[1, 2000\]/ ml.put_data_frame_analytics: - id: "regression-maximum-number-trees-is-zero" + id: "regression-max-trees-is-zero" body: > { "source": { @@ -1350,18 +1350,18 @@ setup: "analysis": { "regression": { "dependent_variable": "foo", - "maximum_number_trees": 0 + "max_trees": 0 } } } --- -"Test put regression given maximum_number_trees is greater than 2k": +"Test put regression given max_trees is greater than 2k": - do: - catch: /\[maximum_number_trees\] must be an integer in \[1, 2000\]/ + catch: /\[max_trees\] must be an integer in \[1, 2000\]/ ml.put_data_frame_analytics: - id: "regression-maximum-number-trees-greater-than-2k" + id: "regression-max-trees-greater-than-2k" body: > { "source": { @@ -1373,7 +1373,7 @@ setup: "analysis": { "regression": { "dependent_variable": "foo", - "maximum_number_trees": 2001 + "max_trees": 2001 } } } @@ -1490,7 +1490,7 @@ setup: "lambda": 3.14, "gamma": 0.42, "eta": 0.5, - "maximum_number_trees": 400, + "max_trees": 400, "feature_bag_fraction": 0.3, "training_percent": 60.3, "randomize_seed": 42 @@ -1506,7 +1506,7 @@ setup: "lambda": 3.14, "gamma": 0.42, "eta": 0.5, - "maximum_number_trees": 400, + "max_trees": 400, "feature_bag_fraction": 0.3, "prediction_field_name": "foo_prediction", "training_percent": 60.3, @@ -1629,12 +1629,12 @@ setup: } --- -"Test put classification given maximum_number_trees is zero": +"Test put classification given max_trees is zero": - do: - catch: /\[maximum_number_trees\] must be an integer in \[1, 2000\]/ + catch: /\[max_trees\] must be an integer in \[1, 2000\]/ ml.put_data_frame_analytics: - id: "classification-maximum-number-trees-is-zero" + id: "classification-max-trees-is-zero" body: > { "source": { @@ -1646,18 +1646,18 @@ setup: "analysis": { "classification": { "dependent_variable": "foo", - "maximum_number_trees": 0 + "max_trees": 0 } } } --- -"Test put classification given maximum_number_trees is greater than 2k": +"Test put classification given max_trees is greater than 2k": - do: - catch: /\[maximum_number_trees\] must be an integer in \[1, 2000\]/ + catch: /\[max_trees\] must be an integer in \[1, 2000\]/ ml.put_data_frame_analytics: - id: "classification-maximum-number-trees-greater-than-2k" + id: "classification-max-trees-greater-than-2k" body: > { "source": { @@ -1669,7 +1669,7 @@ setup: "analysis": { "classification": { "dependent_variable": "foo", - "maximum_number_trees": 2001 + "max_trees": 2001 } } } @@ -1832,7 +1832,7 @@ setup: "lambda": 3.14, "gamma": 0.42, "eta": 0.5, - "maximum_number_trees": 400, + "max_trees": 400, "feature_bag_fraction": 0.3, "training_percent": 60.3, "randomize_seed": 24 @@ -1848,7 +1848,7 @@ setup: "lambda": 3.14, "gamma": 0.42, "eta": 0.5, - "maximum_number_trees": 400, + "max_trees": 400, "feature_bag_fraction": 0.3, "prediction_field_name": "foo_prediction", "training_percent": 60.3, @@ -1859,6 +1859,49 @@ setup: - is_true: create_time - is_true: version +--- +"Test put classification given deprecated maximum_number_trees": + + - skip: + features: allowed_warnings + + - do: + allowed_warnings: + - 'Deprecated field [maximum_number_trees] used, expected [max_trees] instead' + ml.put_data_frame_analytics: + id: "classification-with-maximum-number-trees" + body: > + { + "source": { + "index": "index-source" + }, + "dest": { + "index": "index-dest" + }, + "analysis": { + "classification": { + "dependent_variable": "foo", + "maximum_number_trees": 400, + "randomize_seed": 24 + } + } + } + - match: { id: "classification-with-maximum-number-trees" } + - match: { source.index: ["index-source"] } + - match: { dest.index: "index-dest" } + - match: { analysis: { + "classification":{ + "dependent_variable": "foo", + "max_trees": 400, + "prediction_field_name": "foo_prediction", + "training_percent": 100.0, + "randomize_seed": 24, + "num_top_classes": 2 + } + }} + - is_true: create_time + - is_true: version + --- "Test put with description": From 6ec631653b1b7032e49dea1c352ea6a0088d35b4 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Tue, 10 Mar 2020 13:23:02 +0200 Subject: [PATCH 4/6] Fix test names in security yml tests --- x-pack/plugin/ml/qa/ml-with-security/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugin/ml/qa/ml-with-security/build.gradle b/x-pack/plugin/ml/qa/ml-with-security/build.gradle index 2ac378e472a7b..ed90561faf1e9 100644 --- a/x-pack/plugin/ml/qa/ml-with-security/build.gradle +++ b/x-pack/plugin/ml/qa/ml-with-security/build.gradle @@ -76,8 +76,8 @@ integTest.runner { 'ml/data_frame_analytics_crud/Test put regression given negative gamma', 'ml/data_frame_analytics_crud/Test put regression given eta less than 1e-3', 'ml/data_frame_analytics_crud/Test put regression given eta greater than one', - 'ml/data_frame_analytics_crud/Test put regression given maximum_number_trees is zero', - 'ml/data_frame_analytics_crud/Test put regression given maximum_number_trees is greater than 2k', + 'ml/data_frame_analytics_crud/Test put regression given max_trees is zero', + 'ml/data_frame_analytics_crud/Test put regression given max_trees is greater than 2k', 'ml/data_frame_analytics_crud/Test put regression given feature_bag_fraction is negative', 'ml/data_frame_analytics_crud/Test put regression given feature_bag_fraction is greater than one', 'ml/data_frame_analytics_crud/Test put regression given training_percent is less than one', @@ -87,8 +87,8 @@ integTest.runner { 'ml/data_frame_analytics_crud/Test put classification given negative gamma', 'ml/data_frame_analytics_crud/Test put classification given eta less than 1e-3', 'ml/data_frame_analytics_crud/Test put classification given eta greater than one', - 'ml/data_frame_analytics_crud/Test put classification given maximum_number_trees is zero', - 'ml/data_frame_analytics_crud/Test put classification given maximum_number_trees is greater than 2k', + 'ml/data_frame_analytics_crud/Test put classification given max_trees is zero', + 'ml/data_frame_analytics_crud/Test put classification given max_trees is greater than 2k', 'ml/data_frame_analytics_crud/Test put classification given feature_bag_fraction is negative', 'ml/data_frame_analytics_crud/Test put classification given feature_bag_fraction is greater than one', 'ml/data_frame_analytics_crud/Test put classification given num_top_classes is less than zero', From e46e0081229c09a46bfe41ee06a14212af5cae82 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Tue, 10 Mar 2020 15:39:01 +0200 Subject: [PATCH 5/6] Remove maximum_number_trees from mappings --- .../xpack/core/ml/config_index_mappings.json | 6 ------ .../MlConfigIndexMappingsFullClusterRestartIT.java | 11 ++++++++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json b/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json index 9098ff084afc2..5ee5957e49331 100644 --- a/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json +++ b/x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/core/ml/config_index_mappings.json @@ -40,9 +40,6 @@ "lambda" : { "type" : "double" }, - "maximum_number_trees" : { - "type" : "integer" - }, "max_trees" : { "type" : "integer" }, @@ -90,9 +87,6 @@ "lambda" : { "type" : "double" }, - "maximum_number_trees" : { - "type" : "integer" - }, "max_trees" : { "type" : "integer" }, diff --git a/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlConfigIndexMappingsFullClusterRestartIT.java b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlConfigIndexMappingsFullClusterRestartIT.java index 2dc76febf8dc4..6d8ce026ed3d0 100644 --- a/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlConfigIndexMappingsFullClusterRestartIT.java +++ b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlConfigIndexMappingsFullClusterRestartIT.java @@ -77,7 +77,16 @@ public void testMlConfigIndexMappingsAfterMigration() throws Exception { // trigger .ml-config index mappings update createAnomalyDetectorJob(NEW_CLUSTER_JOB_ID); // assert that the mappings are updated - assertThat(getConfigIndexMappings(), equalTo(expectedConfigIndexMappings)); + Map configIndexMappings = getConfigIndexMappings(); + + // Remove renamed fields + if (getOldClusterVersion().onOrAfter(Version.V_7_7_0)) { + configIndexMappings = XContentMapValues.filter(expectedConfigIndexMappings, null, new String[] { + "analysis.properties.*.properties.maximum_number_trees" // This was renamed to max_trees + }); + } + + assertThat(configIndexMappings, equalTo(expectedConfigIndexMappings)); } } From db42d62ac48829e441d5f105fdb06a1dd20daa20 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Tue, 10 Mar 2020 17:38:15 +0200 Subject: [PATCH 6/6] Fix tests --- .../xpack/core/ml/job/results/ReservedFieldNames.java | 1 - .../restart/MlConfigIndexMappingsFullClusterRestartIT.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) 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 a325be166a88b..b4a8054cca85a 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 @@ -322,7 +322,6 @@ public final class ReservedFieldNames { BoostedTreeParams.LAMBDA.getPreferredName(), BoostedTreeParams.GAMMA.getPreferredName(), BoostedTreeParams.ETA.getPreferredName(), - "maximum_number_trees", BoostedTreeParams.MAX_TREES.getPreferredName(), BoostedTreeParams.FEATURE_BAG_FRACTION.getPreferredName(), BoostedTreeParams.NUM_TOP_FEATURE_IMPORTANCE_VALUES.getPreferredName(), diff --git a/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlConfigIndexMappingsFullClusterRestartIT.java b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlConfigIndexMappingsFullClusterRestartIT.java index 6d8ce026ed3d0..d6651382e4e4d 100644 --- a/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlConfigIndexMappingsFullClusterRestartIT.java +++ b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlConfigIndexMappingsFullClusterRestartIT.java @@ -80,7 +80,7 @@ public void testMlConfigIndexMappingsAfterMigration() throws Exception { Map configIndexMappings = getConfigIndexMappings(); // Remove renamed fields - if (getOldClusterVersion().onOrAfter(Version.V_7_7_0)) { + if (getOldClusterVersion().before(Version.V_8_0_0)) { configIndexMappings = XContentMapValues.filter(expectedConfigIndexMappings, null, new String[] { "analysis.properties.*.properties.maximum_number_trees" // This was renamed to max_trees });