parent
267183998e
commit
dd6c13fdf9
|
@ -48,6 +48,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ParseField ID = new ParseField("id");
|
private static final ParseField ID = new ParseField("id");
|
||||||
|
private static final ParseField DESCRIPTION = new ParseField("description");
|
||||||
private static final ParseField SOURCE = new ParseField("source");
|
private static final ParseField SOURCE = new ParseField("source");
|
||||||
private static final ParseField DEST = new ParseField("dest");
|
private static final ParseField DEST = new ParseField("dest");
|
||||||
private static final ParseField ANALYSIS = new ParseField("analysis");
|
private static final ParseField ANALYSIS = new ParseField("analysis");
|
||||||
|
@ -60,6 +61,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString(Builder::setId, ID);
|
PARSER.declareString(Builder::setId, ID);
|
||||||
|
PARSER.declareString(Builder::setDescription, DESCRIPTION);
|
||||||
PARSER.declareObject(Builder::setSource, (p, c) -> DataFrameAnalyticsSource.fromXContent(p), SOURCE);
|
PARSER.declareObject(Builder::setSource, (p, c) -> DataFrameAnalyticsSource.fromXContent(p), SOURCE);
|
||||||
PARSER.declareObject(Builder::setDest, (p, c) -> DataFrameAnalyticsDest.fromXContent(p), DEST);
|
PARSER.declareObject(Builder::setDest, (p, c) -> DataFrameAnalyticsDest.fromXContent(p), DEST);
|
||||||
PARSER.declareObject(Builder::setAnalysis, (p, c) -> parseAnalysis(p), ANALYSIS);
|
PARSER.declareObject(Builder::setAnalysis, (p, c) -> parseAnalysis(p), ANALYSIS);
|
||||||
|
@ -95,6 +97,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
|
private final String description;
|
||||||
private final DataFrameAnalyticsSource source;
|
private final DataFrameAnalyticsSource source;
|
||||||
private final DataFrameAnalyticsDest dest;
|
private final DataFrameAnalyticsDest dest;
|
||||||
private final DataFrameAnalysis analysis;
|
private final DataFrameAnalysis analysis;
|
||||||
|
@ -103,10 +106,12 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
private final Instant createTime;
|
private final Instant createTime;
|
||||||
private final Version version;
|
private final Version version;
|
||||||
|
|
||||||
private DataFrameAnalyticsConfig(@Nullable String id, @Nullable DataFrameAnalyticsSource source, @Nullable DataFrameAnalyticsDest dest,
|
private DataFrameAnalyticsConfig(@Nullable String id, @Nullable String description, @Nullable DataFrameAnalyticsSource source,
|
||||||
@Nullable DataFrameAnalysis analysis, @Nullable FetchSourceContext analyzedFields,
|
@Nullable DataFrameAnalyticsDest dest, @Nullable DataFrameAnalysis analysis,
|
||||||
@Nullable ByteSizeValue modelMemoryLimit, @Nullable Instant createTime, @Nullable Version version) {
|
@Nullable FetchSourceContext analyzedFields, @Nullable ByteSizeValue modelMemoryLimit,
|
||||||
|
@Nullable Instant createTime, @Nullable Version version) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.description = description;
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.dest = dest;
|
this.dest = dest;
|
||||||
this.analysis = analysis;
|
this.analysis = analysis;
|
||||||
|
@ -120,6 +125,10 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
public DataFrameAnalyticsSource getSource() {
|
public DataFrameAnalyticsSource getSource() {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +163,9 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
builder.field(ID.getPreferredName(), id);
|
builder.field(ID.getPreferredName(), id);
|
||||||
}
|
}
|
||||||
|
if (description != null) {
|
||||||
|
builder.field(DESCRIPTION.getPreferredName(), description);
|
||||||
|
}
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
builder.field(SOURCE.getPreferredName(), source);
|
builder.field(SOURCE.getPreferredName(), source);
|
||||||
}
|
}
|
||||||
|
@ -189,6 +201,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
|
|
||||||
DataFrameAnalyticsConfig other = (DataFrameAnalyticsConfig) o;
|
DataFrameAnalyticsConfig other = (DataFrameAnalyticsConfig) o;
|
||||||
return Objects.equals(id, other.id)
|
return Objects.equals(id, other.id)
|
||||||
|
&& Objects.equals(description, other.description)
|
||||||
&& Objects.equals(source, other.source)
|
&& Objects.equals(source, other.source)
|
||||||
&& Objects.equals(dest, other.dest)
|
&& Objects.equals(dest, other.dest)
|
||||||
&& Objects.equals(analysis, other.analysis)
|
&& Objects.equals(analysis, other.analysis)
|
||||||
|
@ -200,7 +213,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(id, source, dest, analysis, analyzedFields, modelMemoryLimit, createTime, version);
|
return Objects.hash(id, description, source, dest, analysis, analyzedFields, modelMemoryLimit, createTime, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -211,6 +224,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
private String description;
|
||||||
private DataFrameAnalyticsSource source;
|
private DataFrameAnalyticsSource source;
|
||||||
private DataFrameAnalyticsDest dest;
|
private DataFrameAnalyticsDest dest;
|
||||||
private DataFrameAnalysis analysis;
|
private DataFrameAnalysis analysis;
|
||||||
|
@ -226,6 +240,11 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder setSource(DataFrameAnalyticsSource source) {
|
public Builder setSource(DataFrameAnalyticsSource source) {
|
||||||
this.source = Objects.requireNonNull(source);
|
this.source = Objects.requireNonNull(source);
|
||||||
return this;
|
return this;
|
||||||
|
@ -262,7 +281,8 @@ public class DataFrameAnalyticsConfig implements ToXContentObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataFrameAnalyticsConfig build() {
|
public DataFrameAnalyticsConfig build() {
|
||||||
return new DataFrameAnalyticsConfig(id, source, dest, analysis, analyzedFields, modelMemoryLimit, createTime, version);
|
return new DataFrameAnalyticsConfig(id, description, source, dest, analysis, analyzedFields, modelMemoryLimit, createTime,
|
||||||
|
version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1257,6 +1257,7 @@ public class MachineLearningIT extends ESRestHighLevelClientTestCase {
|
||||||
.setIndex("put-test-dest-index")
|
.setIndex("put-test-dest-index")
|
||||||
.build())
|
.build())
|
||||||
.setAnalysis(OutlierDetection.createDefault())
|
.setAnalysis(OutlierDetection.createDefault())
|
||||||
|
.setDescription("some description")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
createIndex("put-test-source-index", defaultMappingForTest());
|
createIndex("put-test-source-index", defaultMappingForTest());
|
||||||
|
@ -1273,6 +1274,7 @@ public class MachineLearningIT extends ESRestHighLevelClientTestCase {
|
||||||
assertThat(createdConfig.getAnalysis(), equalTo(config.getAnalysis()));
|
assertThat(createdConfig.getAnalysis(), equalTo(config.getAnalysis()));
|
||||||
assertThat(createdConfig.getAnalyzedFields(), equalTo(config.getAnalyzedFields()));
|
assertThat(createdConfig.getAnalyzedFields(), equalTo(config.getAnalyzedFields()));
|
||||||
assertThat(createdConfig.getModelMemoryLimit(), equalTo(ByteSizeValue.parseBytesSizeValue("1gb", ""))); // default value
|
assertThat(createdConfig.getModelMemoryLimit(), equalTo(ByteSizeValue.parseBytesSizeValue("1gb", ""))); // default value
|
||||||
|
assertThat(createdConfig.getDescription(), equalTo("some description"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetDataFrameAnalyticsConfig_SingleConfig() throws Exception {
|
public void testGetDataFrameAnalyticsConfig_SingleConfig() throws Exception {
|
||||||
|
|
|
@ -2950,6 +2950,7 @@ public class MlClientDocumentationIT extends ESRestHighLevelClientTestCase {
|
||||||
.setAnalysis(outlierDetection) // <4>
|
.setAnalysis(outlierDetection) // <4>
|
||||||
.setAnalyzedFields(analyzedFields) // <5>
|
.setAnalyzedFields(analyzedFields) // <5>
|
||||||
.setModelMemoryLimit(new ByteSizeValue(5, ByteSizeUnit.MB)) // <6>
|
.setModelMemoryLimit(new ByteSizeValue(5, ByteSizeUnit.MB)) // <6>
|
||||||
|
.setDescription("this is an example description") // <7>
|
||||||
.build();
|
.build();
|
||||||
// end::put-data-frame-analytics-config
|
// end::put-data-frame-analytics-config
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,9 @@ public class DataFrameAnalyticsConfigTests extends AbstractXContentTestCase<Data
|
||||||
.setSource(randomSourceConfig())
|
.setSource(randomSourceConfig())
|
||||||
.setDest(randomDestConfig())
|
.setDest(randomDestConfig())
|
||||||
.setAnalysis(randomOutlierDetection());
|
.setAnalysis(randomOutlierDetection());
|
||||||
|
if (randomBoolean()) {
|
||||||
|
builder.setDescription(randomAlphaOfLength(20));
|
||||||
|
}
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
builder.setAnalyzedFields(new FetchSourceContext(true,
|
builder.setAnalyzedFields(new FetchSourceContext(true,
|
||||||
generateRandomStringArray(10, 10, false, false),
|
generateRandomStringArray(10, 10, false, false),
|
||||||
|
|
|
@ -36,6 +36,7 @@ include-tagged::{doc-tests-file}[{api}-config]
|
||||||
<4> The analysis to be performed
|
<4> The analysis to be performed
|
||||||
<5> The fields to be included in / excluded from the analysis
|
<5> The fields to be included in / excluded from the analysis
|
||||||
<6> The memory limit for the model created as part of the analysis process
|
<6> The memory limit for the model created as part of the analysis process
|
||||||
|
<7> Optionally, a human-readable description
|
||||||
|
|
||||||
[id="{upid}-{api}-query-config"]
|
[id="{upid}-{api}-query-config"]
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,9 @@ PUT _ml/data_frame/analytics/loganalytics
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
// TEST[setup:setup_logdata]
|
// TEST[setup:setup_logdata]
|
||||||
|
|
||||||
|
`description`::
|
||||||
|
(Optional, string) A description of the job.
|
||||||
|
|
||||||
`dest`::
|
`dest`::
|
||||||
(object) The destination configuration of the analysis. The `index` property
|
(object) The destination configuration of the analysis. The `index` property
|
||||||
(string) is the name of the index in which to store the results of the
|
(string) is the name of the index in which to store the results of the
|
||||||
|
|
|
@ -65,7 +65,10 @@ and mappings.
|
||||||
(Optional, object) You can specify both `includes` and/or `excludes` patterns. If
|
(Optional, object) You can specify both `includes` and/or `excludes` patterns. If
|
||||||
`analyzed_fields` is not set, only the relevant fields will be included. For
|
`analyzed_fields` is not set, only the relevant fields will be included. For
|
||||||
example, all the numeric fields for {oldetection}.
|
example, all the numeric fields for {oldetection}.
|
||||||
|
|
||||||
|
`description`::
|
||||||
|
(Optional, string) A description of the job.
|
||||||
|
|
||||||
`dest`::
|
`dest`::
|
||||||
(Required, object) The destination configuration, consisting of `index` and
|
(Required, object) The destination configuration, consisting of `index` and
|
||||||
optionally `results_field` (`ml` by default). See
|
optionally `results_field` (`ml` by default). See
|
||||||
|
@ -94,6 +97,7 @@ type is `outlier_detection`:
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
PUT _ml/data_frame/analytics/loganalytics
|
PUT _ml/data_frame/analytics/loganalytics
|
||||||
{
|
{
|
||||||
|
"description": "Outlier detection on log data",
|
||||||
"source": {
|
"source": {
|
||||||
"index": "logdata"
|
"index": "logdata"
|
||||||
},
|
},
|
||||||
|
@ -115,6 +119,7 @@ The API returns the following result:
|
||||||
----
|
----
|
||||||
{
|
{
|
||||||
"id" : "loganalytics",
|
"id" : "loganalytics",
|
||||||
|
"description": "Outlier detection on log data",
|
||||||
"source" : {
|
"source" : {
|
||||||
"index" : [
|
"index" : [
|
||||||
"logdata"
|
"logdata"
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
public static final ByteSizeValue PROCESS_MEMORY_OVERHEAD = new ByteSizeValue(20, ByteSizeUnit.MB);
|
public static final ByteSizeValue PROCESS_MEMORY_OVERHEAD = new ByteSizeValue(20, ByteSizeUnit.MB);
|
||||||
|
|
||||||
public static final ParseField ID = new ParseField("id");
|
public static final ParseField ID = new ParseField("id");
|
||||||
|
public static final ParseField DESCRIPTION = new ParseField("description");
|
||||||
public static final ParseField SOURCE = new ParseField("source");
|
public static final ParseField SOURCE = new ParseField("source");
|
||||||
public static final ParseField DEST = new ParseField("dest");
|
public static final ParseField DEST = new ParseField("dest");
|
||||||
public static final ParseField ANALYSIS = new ParseField("analysis");
|
public static final ParseField ANALYSIS = new ParseField("analysis");
|
||||||
|
@ -62,6 +63,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
|
|
||||||
parser.declareString((c, s) -> {}, CONFIG_TYPE);
|
parser.declareString((c, s) -> {}, CONFIG_TYPE);
|
||||||
parser.declareString(Builder::setId, ID);
|
parser.declareString(Builder::setId, ID);
|
||||||
|
parser.declareString(Builder::setDescription, DESCRIPTION);
|
||||||
parser.declareObject(Builder::setSource, DataFrameAnalyticsSource.createParser(ignoreUnknownFields), SOURCE);
|
parser.declareObject(Builder::setSource, DataFrameAnalyticsSource.createParser(ignoreUnknownFields), SOURCE);
|
||||||
parser.declareObject(Builder::setDest, DataFrameAnalyticsDest.createParser(ignoreUnknownFields), DEST);
|
parser.declareObject(Builder::setDest, DataFrameAnalyticsDest.createParser(ignoreUnknownFields), DEST);
|
||||||
parser.declareObject(Builder::setAnalysis, (p, c) -> parseAnalysis(p, ignoreUnknownFields), ANALYSIS);
|
parser.declareObject(Builder::setAnalysis, (p, c) -> parseAnalysis(p, ignoreUnknownFields), ANALYSIS);
|
||||||
|
@ -100,6 +102,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
|
private final String description;
|
||||||
private final DataFrameAnalyticsSource source;
|
private final DataFrameAnalyticsSource source;
|
||||||
private final DataFrameAnalyticsDest dest;
|
private final DataFrameAnalyticsDest dest;
|
||||||
private final DataFrameAnalysis analysis;
|
private final DataFrameAnalysis analysis;
|
||||||
|
@ -117,10 +120,11 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
private final Instant createTime;
|
private final Instant createTime;
|
||||||
private final Version version;
|
private final Version version;
|
||||||
|
|
||||||
public DataFrameAnalyticsConfig(String id, DataFrameAnalyticsSource source, DataFrameAnalyticsDest dest,
|
public DataFrameAnalyticsConfig(String id, String description, DataFrameAnalyticsSource source, DataFrameAnalyticsDest dest,
|
||||||
DataFrameAnalysis analysis, Map<String, String> headers, ByteSizeValue modelMemoryLimit,
|
DataFrameAnalysis analysis, Map<String, String> headers, ByteSizeValue modelMemoryLimit,
|
||||||
FetchSourceContext analyzedFields, Instant createTime, Version version) {
|
FetchSourceContext analyzedFields, Instant createTime, Version version) {
|
||||||
this.id = ExceptionsHelper.requireNonNull(id, ID);
|
this.id = ExceptionsHelper.requireNonNull(id, ID);
|
||||||
|
this.description = description;
|
||||||
this.source = ExceptionsHelper.requireNonNull(source, SOURCE);
|
this.source = ExceptionsHelper.requireNonNull(source, SOURCE);
|
||||||
this.dest = ExceptionsHelper.requireNonNull(dest, DEST);
|
this.dest = ExceptionsHelper.requireNonNull(dest, DEST);
|
||||||
this.analysis = ExceptionsHelper.requireNonNull(analysis, ANALYSIS);
|
this.analysis = ExceptionsHelper.requireNonNull(analysis, ANALYSIS);
|
||||||
|
@ -133,6 +137,11 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
|
|
||||||
public DataFrameAnalyticsConfig(StreamInput in) throws IOException {
|
public DataFrameAnalyticsConfig(StreamInput in) throws IOException {
|
||||||
this.id = in.readString();
|
this.id = in.readString();
|
||||||
|
if (in.getVersion().onOrAfter(Version.V_7_4_0)) {
|
||||||
|
description = in.readOptionalString();
|
||||||
|
} else {
|
||||||
|
description = null;
|
||||||
|
}
|
||||||
this.source = new DataFrameAnalyticsSource(in);
|
this.source = new DataFrameAnalyticsSource(in);
|
||||||
this.dest = new DataFrameAnalyticsDest(in);
|
this.dest = new DataFrameAnalyticsDest(in);
|
||||||
this.analysis = in.readNamedWriteable(DataFrameAnalysis.class);
|
this.analysis = in.readNamedWriteable(DataFrameAnalysis.class);
|
||||||
|
@ -152,6 +161,10 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
public DataFrameAnalyticsSource getSource() {
|
public DataFrameAnalyticsSource getSource() {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
@ -188,6 +201,9 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field(ID.getPreferredName(), id);
|
builder.field(ID.getPreferredName(), id);
|
||||||
|
if (description != null) {
|
||||||
|
builder.field(DESCRIPTION.getPreferredName(), description);
|
||||||
|
}
|
||||||
builder.field(SOURCE.getPreferredName(), source);
|
builder.field(SOURCE.getPreferredName(), source);
|
||||||
builder.field(DEST.getPreferredName(), dest);
|
builder.field(DEST.getPreferredName(), dest);
|
||||||
|
|
||||||
|
@ -218,6 +234,9 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
@Override
|
@Override
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
out.writeString(id);
|
out.writeString(id);
|
||||||
|
if (out.getVersion().onOrAfter(Version.V_7_4_0)) {
|
||||||
|
out.writeOptionalString(description);
|
||||||
|
}
|
||||||
source.writeTo(out);
|
source.writeTo(out);
|
||||||
dest.writeTo(out);
|
dest.writeTo(out);
|
||||||
out.writeNamedWriteable(analysis);
|
out.writeNamedWriteable(analysis);
|
||||||
|
@ -242,6 +261,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
|
|
||||||
DataFrameAnalyticsConfig other = (DataFrameAnalyticsConfig) o;
|
DataFrameAnalyticsConfig other = (DataFrameAnalyticsConfig) o;
|
||||||
return Objects.equals(id, other.id)
|
return Objects.equals(id, other.id)
|
||||||
|
&& Objects.equals(description, other.description)
|
||||||
&& Objects.equals(source, other.source)
|
&& Objects.equals(source, other.source)
|
||||||
&& Objects.equals(dest, other.dest)
|
&& Objects.equals(dest, other.dest)
|
||||||
&& Objects.equals(analysis, other.analysis)
|
&& Objects.equals(analysis, other.analysis)
|
||||||
|
@ -254,7 +274,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(id, source, dest, analysis, headers, getModelMemoryLimit(), analyzedFields, createTime, version);
|
return Objects.hash(id, description, source, dest, analysis, headers, getModelMemoryLimit(), analyzedFields, createTime, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -269,6 +289,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
private String description;
|
||||||
private DataFrameAnalyticsSource source;
|
private DataFrameAnalyticsSource source;
|
||||||
private DataFrameAnalyticsDest dest;
|
private DataFrameAnalyticsDest dest;
|
||||||
private DataFrameAnalysis analysis;
|
private DataFrameAnalysis analysis;
|
||||||
|
@ -287,6 +308,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
|
|
||||||
public Builder(DataFrameAnalyticsConfig config, ByteSizeValue maxModelMemoryLimit) {
|
public Builder(DataFrameAnalyticsConfig config, ByteSizeValue maxModelMemoryLimit) {
|
||||||
this.id = config.id;
|
this.id = config.id;
|
||||||
|
this.description = config.description;
|
||||||
this.source = new DataFrameAnalyticsSource(config.source);
|
this.source = new DataFrameAnalyticsSource(config.source);
|
||||||
this.dest = new DataFrameAnalyticsDest(config.dest);
|
this.dest = new DataFrameAnalyticsDest(config.dest);
|
||||||
this.analysis = config.analysis;
|
this.analysis = config.analysis;
|
||||||
|
@ -304,6 +326,11 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder setId(String id) {
|
public Builder setId(String id) {
|
||||||
this.id = ExceptionsHelper.requireNonNull(id, ID);
|
this.id = ExceptionsHelper.requireNonNull(id, ID);
|
||||||
return this;
|
return this;
|
||||||
|
@ -354,7 +381,8 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
*/
|
*/
|
||||||
public DataFrameAnalyticsConfig build() {
|
public DataFrameAnalyticsConfig build() {
|
||||||
applyMaxModelMemoryLimit();
|
applyMaxModelMemoryLimit();
|
||||||
return new DataFrameAnalyticsConfig(id, source, dest, analysis, headers, modelMemoryLimit, analyzedFields, createTime, version);
|
return new DataFrameAnalyticsConfig(id, description, source, dest, analysis, headers, modelMemoryLimit, analyzedFields,
|
||||||
|
createTime, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -365,6 +393,7 @@ public class DataFrameAnalyticsConfig implements ToXContentObject, Writeable {
|
||||||
public DataFrameAnalyticsConfig buildForMemoryEstimation() {
|
public DataFrameAnalyticsConfig buildForMemoryEstimation() {
|
||||||
return new DataFrameAnalyticsConfig(
|
return new DataFrameAnalyticsConfig(
|
||||||
id != null ? id : "dummy",
|
id != null ? id : "dummy",
|
||||||
|
description,
|
||||||
source,
|
source,
|
||||||
dest != null ? dest : new DataFrameAnalyticsDest("dummy", null),
|
dest != null ? dest : new DataFrameAnalyticsDest("dummy", null),
|
||||||
analysis,
|
analysis,
|
||||||
|
|
|
@ -286,6 +286,7 @@ public final class ReservedFieldNames {
|
||||||
ChunkingConfig.TIME_SPAN_FIELD.getPreferredName(),
|
ChunkingConfig.TIME_SPAN_FIELD.getPreferredName(),
|
||||||
|
|
||||||
DataFrameAnalyticsConfig.ID.getPreferredName(),
|
DataFrameAnalyticsConfig.ID.getPreferredName(),
|
||||||
|
DataFrameAnalyticsConfig.DESCRIPTION.getPreferredName(),
|
||||||
DataFrameAnalyticsConfig.SOURCE.getPreferredName(),
|
DataFrameAnalyticsConfig.SOURCE.getPreferredName(),
|
||||||
DataFrameAnalyticsConfig.DEST.getPreferredName(),
|
DataFrameAnalyticsConfig.DEST.getPreferredName(),
|
||||||
DataFrameAnalyticsConfig.ANALYSIS.getPreferredName(),
|
DataFrameAnalyticsConfig.ANALYSIS.getPreferredName(),
|
||||||
|
|
|
@ -113,6 +113,9 @@ public class DataFrameAnalyticsConfigTests extends AbstractSerializingTestCase<D
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
builder.setModelMemoryLimit(new ByteSizeValue(randomIntBetween(1, 16), randomFrom(ByteSizeUnit.MB, ByteSizeUnit.GB)));
|
builder.setModelMemoryLimit(new ByteSizeValue(randomIntBetween(1, 16), randomFrom(ByteSizeUnit.MB, ByteSizeUnit.GB)));
|
||||||
}
|
}
|
||||||
|
if (randomBoolean()) {
|
||||||
|
builder.setDescription(randomAlphaOfLength(20));
|
||||||
|
}
|
||||||
if (withGeneratedFields) {
|
if (withGeneratedFields) {
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
builder.setCreateTime(Instant.now());
|
builder.setCreateTime(Instant.now());
|
||||||
|
|
|
@ -1182,3 +1182,36 @@ setup:
|
||||||
}}
|
}}
|
||||||
- is_true: create_time
|
- is_true: create_time
|
||||||
- is_true: version
|
- is_true: version
|
||||||
|
|
||||||
|
---
|
||||||
|
"Test put with description":
|
||||||
|
|
||||||
|
- do:
|
||||||
|
ml.put_data_frame_analytics:
|
||||||
|
id: "with-description"
|
||||||
|
body: >
|
||||||
|
{
|
||||||
|
"description": "This is a described config",
|
||||||
|
"source": {
|
||||||
|
"index": "index-source"
|
||||||
|
},
|
||||||
|
"dest": {
|
||||||
|
"index": "index-dest"
|
||||||
|
},
|
||||||
|
"analysis": {
|
||||||
|
"regression": {
|
||||||
|
"dependent_variable": "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- match: { id: "with-description" }
|
||||||
|
- match: { description: "This is a described config" }
|
||||||
|
- match: { source.index: ["index-source"] }
|
||||||
|
- match: { dest.index: "index-dest" }
|
||||||
|
- match: { analysis: {
|
||||||
|
"regression":{
|
||||||
|
"dependent_variable": "foo"
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
- is_true: create_time
|
||||||
|
- is_true: version
|
||||||
|
|
Loading…
Reference in New Issue