diff --git a/src/main/java/org/opensearch/ad/model/ADTask.java b/src/main/java/org/opensearch/ad/model/ADTask.java index 19fc87682..d51d39022 100644 --- a/src/main/java/org/opensearch/ad/model/ADTask.java +++ b/src/main/java/org/opensearch/ad/model/ADTask.java @@ -344,8 +344,7 @@ public static ADTask parse(XContentParser parser, String taskId) throws IOExcept detector.getRules(), detector.getCustomResultIndexMinSize(), detector.getCustomResultIndexMinAge(), - detector.getCustomResultIndexTTL(), - detector.getFlattenResultIndexMapping() + detector.getCustomResultIndexTTL() ); return new Builder() .taskId(parsedTaskId) diff --git a/src/main/java/org/opensearch/ad/model/AnomalyDetector.java b/src/main/java/org/opensearch/ad/model/AnomalyDetector.java index d88ffa653..f5de3bba6 100644 --- a/src/main/java/org/opensearch/ad/model/AnomalyDetector.java +++ b/src/main/java/org/opensearch/ad/model/AnomalyDetector.java @@ -150,7 +150,6 @@ public Integer getShingleSize(Integer customShingleSize) { * @param customResultIndexMinSize custom result index lifecycle management min size condition * @param customResultIndexMinAge custom result index lifecycle management min age condition * @param customResultIndexTTL custom result index lifecycle management ttl - * @param flattenResultIndexMapping flag to indicate whether to flatten result index mapping or not */ public AnomalyDetector( String detectorId, @@ -177,8 +176,7 @@ public AnomalyDetector( List rules, Integer customResultIndexMinSize, Integer customResultIndexMinAge, - Integer customResultIndexTTL, - Boolean flattenResultIndexMapping + Integer customResultIndexTTL ) { super( detectorId, @@ -205,8 +203,7 @@ public AnomalyDetector( historyIntervals, customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); checkAndThrowValidationErrors(ValidationAspect.DETECTOR); @@ -283,7 +280,6 @@ public AnomalyDetector(StreamInput input) throws IOException { this.customResultIndexMinSize = input.readOptionalInt(); this.customResultIndexMinAge = input.readOptionalInt(); this.customResultIndexTTL = input.readOptionalInt(); - this.flattenResultIndexMapping = input.readOptionalBoolean(); } public XContentBuilder toXContent(XContentBuilder builder) throws IOException { @@ -349,7 +345,6 @@ public void writeTo(StreamOutput output) throws IOException { output.writeOptionalInt(customResultIndexMinSize); output.writeOptionalInt(customResultIndexMinAge); output.writeOptionalInt(customResultIndexTTL); - output.writeOptionalBoolean(flattenResultIndexMapping); } @Override @@ -446,7 +441,6 @@ public static AnomalyDetector parse( Integer customResultIndexMinSize = null; Integer customResultIndexMinAge = null; Integer customResultIndexTTL = null; - Boolean flattenResultIndexMapping = null; ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser); while (parser.nextToken() != XContentParser.Token.END_OBJECT) { @@ -581,9 +575,6 @@ public static AnomalyDetector parse( case RESULT_INDEX_FIELD_TTL: customResultIndexTTL = onlyParseNumberValue(parser); break; - case FLATTEN_RESULT_INDEX_MAPPING: - flattenResultIndexMapping = onlyParseBooleanValue(parser); - break; default: parser.skipChildren(); break; @@ -614,8 +605,7 @@ public static AnomalyDetector parse( rules, customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); detector.setDetectionDateRange(detectionDateRange); return detector; @@ -702,11 +692,4 @@ private static Integer onlyParseNumberValue(XContentParser parser) throws IOExce } return null; } - - private static Boolean onlyParseBooleanValue(XContentParser parser) throws IOException { - if (parser.currentToken() == XContentParser.Token.VALUE_BOOLEAN) { - return parser.booleanValue(); - } - return null; - } } diff --git a/src/main/java/org/opensearch/ad/rest/handler/AbstractAnomalyDetectorActionHandler.java b/src/main/java/org/opensearch/ad/rest/handler/AbstractAnomalyDetectorActionHandler.java index 7c86610a4..1219107c4 100644 --- a/src/main/java/org/opensearch/ad/rest/handler/AbstractAnomalyDetectorActionHandler.java +++ b/src/main/java/org/opensearch/ad/rest/handler/AbstractAnomalyDetectorActionHandler.java @@ -244,8 +244,7 @@ protected AnomalyDetector copyConfig(User user, Config config) { detector.getRules(), config.getCustomResultIndexMinSize(), config.getCustomResultIndexMinAge(), - config.getCustomResultIndexTTL(), - config.getFlattenResultIndexMapping() + config.getCustomResultIndexTTL() ); } diff --git a/src/main/java/org/opensearch/forecast/model/ForecastTask.java b/src/main/java/org/opensearch/forecast/model/ForecastTask.java index bb6a53d50..33bd114ab 100644 --- a/src/main/java/org/opensearch/forecast/model/ForecastTask.java +++ b/src/main/java/org/opensearch/forecast/model/ForecastTask.java @@ -342,8 +342,7 @@ public static ForecastTask parse(XContentParser parser, String taskId) throws IO forecaster.getHistoryIntervals(), forecaster.getCustomResultIndexMinSize(), forecaster.getCustomResultIndexMinAge(), - forecaster.getCustomResultIndexTTL(), - forecaster.getFlattenResultIndexMapping() + forecaster.getCustomResultIndexTTL() ); return new Builder() .taskId(parsedTaskId) diff --git a/src/main/java/org/opensearch/forecast/model/Forecaster.java b/src/main/java/org/opensearch/forecast/model/Forecaster.java index 0cac28d8b..8feb24795 100644 --- a/src/main/java/org/opensearch/forecast/model/Forecaster.java +++ b/src/main/java/org/opensearch/forecast/model/Forecaster.java @@ -134,8 +134,7 @@ public Forecaster( Integer historyIntervals, Integer customResultIndexMinSize, Integer customResultIndexMinAge, - Integer customResultIndexTTL, - Boolean flattenResultIndexMapping + Integer customResultIndexTTL ) { super( forecasterId, @@ -162,8 +161,7 @@ public Forecaster( historyIntervals, customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); checkAndThrowValidationErrors(ValidationAspect.FORECASTER); @@ -305,7 +303,6 @@ public static Forecaster parse( Integer customResultIndexMinSize = null; Integer customResultIndexMinAge = null; Integer customResultIndexTTL = null; - Boolean flattenResultIndexMapping = null; ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser); while (parser.nextToken() != XContentParser.Token.END_OBJECT) { @@ -434,9 +431,6 @@ public static Forecaster parse( case RESULT_INDEX_FIELD_TTL: customResultIndexTTL = parser.intValue(); break; - case FLATTEN_RESULT_INDEX_MAPPING: - flattenResultIndexMapping = parser.booleanValue(); - break; default: parser.skipChildren(); break; @@ -467,8 +461,7 @@ public static Forecaster parse( historyIntervals, customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); return forecaster; } diff --git a/src/main/java/org/opensearch/forecast/rest/handler/AbstractForecasterActionHandler.java b/src/main/java/org/opensearch/forecast/rest/handler/AbstractForecasterActionHandler.java index 58033c199..15e30ef76 100644 --- a/src/main/java/org/opensearch/forecast/rest/handler/AbstractForecasterActionHandler.java +++ b/src/main/java/org/opensearch/forecast/rest/handler/AbstractForecasterActionHandler.java @@ -257,8 +257,7 @@ protected Config copyConfig(User user, Config config) { config.getHistoryIntervals(), config.getCustomResultIndexMinSize(), config.getCustomResultIndexMinAge(), - config.getCustomResultIndexTTL(), - config.getFlattenResultIndexMapping() + config.getCustomResultIndexTTL() ); } diff --git a/src/main/java/org/opensearch/timeseries/model/Config.java b/src/main/java/org/opensearch/timeseries/model/Config.java index 8c0586cde..2da4c3a77 100644 --- a/src/main/java/org/opensearch/timeseries/model/Config.java +++ b/src/main/java/org/opensearch/timeseries/model/Config.java @@ -79,7 +79,6 @@ public abstract class Config implements Writeable, ToXContentObject { public static final String RESULT_INDEX_FIELD_MIN_SIZE = "result_index_min_size"; public static final String RESULT_INDEX_FIELD_MIN_AGE = "result_index_min_age"; public static final String RESULT_INDEX_FIELD_TTL = "result_index_ttl"; - public static final String FLATTEN_RESULT_INDEX_MAPPING = "flatten_result_index_mapping"; protected String id; protected Long version; @@ -119,7 +118,6 @@ public abstract class Config implements Writeable, ToXContentObject { protected Integer customResultIndexMinSize; protected Integer customResultIndexMinAge; protected Integer customResultIndexTTL; - protected Boolean flattenResultIndexMapping; public static String INVALID_RESULT_INDEX_NAME_SIZE = "Result index name size must contains less than " + MAX_RESULT_INDEX_NAME_SIZE @@ -150,8 +148,7 @@ protected Config( Integer historyIntervals, Integer customResultIndexMinSize, Integer customResultIndexMinAge, - Integer customResultIndexTTL, - Boolean flattenResultIndexMapping + Integer customResultIndexTTL ) { if (Strings.isBlank(name)) { errorMessage = CommonMessages.EMPTY_NAME; @@ -290,7 +287,6 @@ protected Config( this.customResultIndexMinSize = Strings.trimToNull(resultIndex) == null ? null : customResultIndexMinSize; this.customResultIndexMinAge = Strings.trimToNull(resultIndex) == null ? null : customResultIndexMinAge; this.customResultIndexTTL = Strings.trimToNull(resultIndex) == null ? null : customResultIndexTTL; - this.flattenResultIndexMapping = Strings.trimToNull(resultIndex) == null ? null : flattenResultIndexMapping; } public int suggestHistory() { @@ -334,7 +330,6 @@ public Config(StreamInput input) throws IOException { this.customResultIndexMinSize = input.readOptionalInt(); this.customResultIndexMinAge = input.readOptionalInt(); this.customResultIndexTTL = input.readOptionalInt(); - this.flattenResultIndexMapping = input.readOptionalBoolean(); } /* @@ -387,7 +382,6 @@ public void writeTo(StreamOutput output) throws IOException { output.writeOptionalInt(customResultIndexMinSize); output.writeOptionalInt(customResultIndexMinAge); output.writeOptionalInt(customResultIndexTTL); - output.writeOptionalBoolean(flattenResultIndexMapping); } public boolean invalidShingleSizeRange(Integer shingleSizeToTest) { @@ -444,8 +438,7 @@ public boolean equals(Object o) { && Objects.equal(historyIntervals, config.historyIntervals) && Objects.equal(customResultIndexMinSize, config.customResultIndexMinSize) && Objects.equal(customResultIndexMinAge, config.customResultIndexMinAge) - && Objects.equal(customResultIndexTTL, config.customResultIndexTTL) - && Objects.equal(flattenResultIndexMapping, config.flattenResultIndexMapping); + && Objects.equal(customResultIndexTTL, config.customResultIndexTTL); } @Generated @@ -472,8 +465,7 @@ public int hashCode() { historyIntervals, customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); } @@ -522,9 +514,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (customResultIndexTTL != null) { builder.field(RESULT_INDEX_FIELD_TTL, customResultIndexTTL); } - if (flattenResultIndexMapping != null) { - builder.field(FLATTEN_RESULT_INDEX_MAPPING, flattenResultIndexMapping); - } return builder; } @@ -733,10 +722,6 @@ public Integer getCustomResultIndexTTL() { return customResultIndexTTL; } - public Boolean getFlattenResultIndexMapping() { - return flattenResultIndexMapping; - } - /** * Identifies redundant feature names. * @@ -789,7 +774,6 @@ public String toString() { .append("customResultIndexMinSize", customResultIndexMinSize) .append("customResultIndexMinAge", customResultIndexMinAge) .append("customResultIndexTTL", customResultIndexTTL) - .append("flattenResultIndexMapping", flattenResultIndexMapping) .toString(); } } diff --git a/src/test/java/org/opensearch/ad/AnomalyDetectorRestTestCase.java b/src/test/java/org/opensearch/ad/AnomalyDetectorRestTestCase.java index 627be0240..5500d28cc 100644 --- a/src/test/java/org/opensearch/ad/AnomalyDetectorRestTestCase.java +++ b/src/test/java/org/opensearch/ad/AnomalyDetectorRestTestCase.java @@ -314,8 +314,7 @@ public ToXContentObject[] getConfig(String detectorId, BasicHeader header, boole null, detector.getCustomResultIndexMinSize(), detector.getCustomResultIndexMinAge(), - detector.getCustomResultIndexTTL(), - detector.getFlattenResultIndexMapping() + detector.getCustomResultIndexTTL() ), detectorJob, historicalAdTask, @@ -641,8 +640,7 @@ protected AnomalyDetector cloneDetector(AnomalyDetector anomalyDetector, String null, anomalyDetector.getCustomResultIndexMinSize(), anomalyDetector.getCustomResultIndexMinAge(), - anomalyDetector.getCustomResultIndexTTL(), - anomalyDetector.getFlattenResultIndexMapping() + anomalyDetector.getCustomResultIndexTTL() ); return detector; } diff --git a/src/test/java/org/opensearch/ad/model/AnomalyDetectorTests.java b/src/test/java/org/opensearch/ad/model/AnomalyDetectorTests.java index 39e515708..9305e387a 100644 --- a/src/test/java/org/opensearch/ad/model/AnomalyDetectorTests.java +++ b/src/test/java/org/opensearch/ad/model/AnomalyDetectorTests.java @@ -343,7 +343,6 @@ public void testInvalidShingleSize() throws Exception { null, null, null, - null, null ) ); @@ -380,7 +379,6 @@ public void testNullDetectorName() throws Exception { null, null, null, - null, null ) ); @@ -417,7 +415,6 @@ public void testBlankDetectorName() throws Exception { null, null, null, - null, null ) ); @@ -454,7 +451,6 @@ public void testNullTimeField() throws Exception { null, null, null, - null, null ) ); @@ -491,7 +487,6 @@ public void testNullIndices() throws Exception { null, null, null, - null, null ) ); @@ -528,7 +523,6 @@ public void testEmptyIndices() throws Exception { null, null, null, - null, null ) ); @@ -565,7 +559,6 @@ public void testNullDetectionInterval() throws Exception { null, null, null, - null, null ) ); @@ -601,7 +594,6 @@ public void testInvalidRecency() { null, null, null, - null, null ) ); @@ -638,7 +630,6 @@ public void testInvalidDetectionInterval() { null, null, null, - null, null ) ); @@ -675,7 +666,6 @@ public void testInvalidWindowDelay() { null, null, null, - null, null ) ); @@ -725,7 +715,6 @@ public void testGetShingleSize() throws IOException { null, null, null, - null, null ); assertEquals((int) anomalyDetector.getShingleSize(), 5); @@ -760,7 +749,6 @@ public void testGetShingleSizeReturnsDefaultValue() throws IOException { null, null, null, - null, null ); // seasonalityIntervals is not null and custom shingle size is null, use seasonalityIntervals to deterine shingle size @@ -791,7 +779,6 @@ public void testGetShingleSizeReturnsDefaultValue() throws IOException { null, null, null, - null, null ); // seasonalityIntervals is null and custom shingle size is null, use default shingle size @@ -824,7 +811,6 @@ public void testNullFeatureAttributes() throws IOException { null, null, null, - null, null ); assertNotNull(anomalyDetector.getFeatureAttributes()); @@ -857,7 +843,6 @@ public void testValidateResultIndex() throws IOException { null, null, null, - null, null ); String errorMessage = anomalyDetector.validateCustomResultIndex("abc"); @@ -946,20 +931,6 @@ public void testParseAnomalyDetector_withCustomIndex_withCustomResultIndexTTL() assertEquals(30, (int) parsedDetector.getCustomResultIndexTTL()); } - public void testParseAnomalyDetector_withCustomIndex_withFlattenResultIndexMapping() throws IOException { - String detectorString = "{\"name\":\"AhtYYGWTgqkzairTchcs\",\"description\":\"iIiAVPMyFgnFlEniLbMyfJxyoGvJAl\"," - + "\"time_field\":\"HmdFH\",\"indices\":[\"ffsBF\"],\"filter_query\":{\"bool\":{\"filter\":[{\"exists\":" - + "{\"field\":\"value\",\"boost\":1}}],\"adjust_pure_negative\":true,\"boost\":1}},\"window_delay\":" - + "{\"period\":{\"interval\":2,\"unit\":\"Minutes\"}},\"shingle_size\":8,\"schema_version\":-512063255," - + "\"feature_attributes\":[{\"feature_id\":\"OTYJs\",\"feature_name\":\"eYYCM\",\"feature_enabled\":false," - + "\"aggregation_query\":{\"XzewX\":{\"value_count\":{\"field\":\"ok\"}}}}],\"recency_emphasis\":3342," - + "\"history\":62,\"last_update_time\":1717192049845,\"category_field\":[\"Tcqcb\"],\"result_index\":" - + "\"opensearch-ad-plugin-result-test\",\"imputation_option\":{\"method\":\"ZERO\"},\"suggested_seasonality\":64,\"detection_interval\":{\"period\":" - + "{\"interval\":5,\"unit\":\"Minutes\"}},\"detector_type\":\"MULTI_ENTITY\",\"rules\":[],\"flatten_result_index_mapping\":true}"; - AnomalyDetector parsedDetector = AnomalyDetector.parse(TestHelpers.parser(detectorString), "id", 1L, null, null); - assertEquals(true, (boolean) parsedDetector.getFlattenResultIndexMapping()); - } - public void testSerializeAndDeserializeAnomalyDetector() throws IOException { // register writer and reader for type Feature Writeable.WriteableRegistry.registerWriter(Feature.class, (o, v) -> { diff --git a/src/test/java/org/opensearch/ad/rest/ADRestTestUtils.java b/src/test/java/org/opensearch/ad/rest/ADRestTestUtils.java index 0ffe7b5d7..7ffa7170d 100644 --- a/src/test/java/org/opensearch/ad/rest/ADRestTestUtils.java +++ b/src/test/java/org/opensearch/ad/rest/ADRestTestUtils.java @@ -225,7 +225,6 @@ public static Response createAnomalyDetector( null, null, null, - null, null ); diff --git a/src/test/java/org/opensearch/ad/rest/AnomalyDetectorRestApiIT.java b/src/test/java/org/opensearch/ad/rest/AnomalyDetectorRestApiIT.java index 7957284af..af58f7aed 100644 --- a/src/test/java/org/opensearch/ad/rest/AnomalyDetectorRestApiIT.java +++ b/src/test/java/org/opensearch/ad/rest/AnomalyDetectorRestApiIT.java @@ -158,7 +158,6 @@ public void testCreateAnomalyDetectorWithDuplicateName() throws Exception { null, null, null, - null, null ); @@ -270,7 +269,6 @@ public void testUpdateAnomalyDetectorCategoryField() throws Exception { null, null, null, - null, null ); Exception ex = expectThrows( @@ -337,7 +335,6 @@ public void testUpdateAnomalyDetector() throws Exception { null, null, null, - null, null ); @@ -409,7 +406,6 @@ public void testUpdateAnomalyDetectorNameToExisting() throws Exception { null, null, null, - null, null ); @@ -458,7 +454,6 @@ public void testUpdateAnomalyDetectorNameToNew() throws Exception { null, null, null, - null, null ); @@ -513,7 +508,6 @@ public void testUpdateAnomalyDetectorWithNotExistingIndex() throws Exception { null, null, null, - null, null ); @@ -885,7 +879,6 @@ public void testUpdateAnomalyDetectorWithRunningAdJob() throws Exception { null, null, null, - null, null ); diff --git a/src/test/java/org/opensearch/ad/rest/HistoricalAnalysisRestApiIT.java b/src/test/java/org/opensearch/ad/rest/HistoricalAnalysisRestApiIT.java index 2f2cf5225..c42ecb2cc 100644 --- a/src/test/java/org/opensearch/ad/rest/HistoricalAnalysisRestApiIT.java +++ b/src/test/java/org/opensearch/ad/rest/HistoricalAnalysisRestApiIT.java @@ -341,8 +341,7 @@ private AnomalyDetector randomAnomalyDetector(AnomalyDetector detector) { null, detector.getCustomResultIndexMinSize(), detector.getCustomResultIndexMinAge(), - detector.getCustomResultIndexTTL(), - detector.getFlattenResultIndexMapping() + detector.getCustomResultIndexTTL() ); } diff --git a/src/test/java/org/opensearch/ad/rest/SecureADRestIT.java b/src/test/java/org/opensearch/ad/rest/SecureADRestIT.java index cd744781e..a63917f0f 100644 --- a/src/test/java/org/opensearch/ad/rest/SecureADRestIT.java +++ b/src/test/java/org/opensearch/ad/rest/SecureADRestIT.java @@ -293,7 +293,6 @@ public void testUpdateApiFilterByEnabledForAdmin() throws IOException { null, null, null, - null, null ); // User client has admin all access, and has "opensearch" backend role so client should be able to update detector @@ -348,7 +347,6 @@ public void testUpdateApiFilterByEnabled() throws IOException { null, null, null, - null, null ); enableFilterBy(); diff --git a/src/test/java/org/opensearch/ad/transport/AnomalyResultTransportActionTests.java b/src/test/java/org/opensearch/ad/transport/AnomalyResultTransportActionTests.java index 7c8d4f3c2..b1deb5025 100644 --- a/src/test/java/org/opensearch/ad/transport/AnomalyResultTransportActionTests.java +++ b/src/test/java/org/opensearch/ad/transport/AnomalyResultTransportActionTests.java @@ -226,7 +226,6 @@ private AnomalyDetector randomDetector(List indices, List featu null, null, null, - null, null ); } @@ -257,7 +256,6 @@ private AnomalyDetector randomHCDetector(List indices, List fea null, null, null, - null, null ); } diff --git a/src/test/java/org/opensearch/ad/transport/ForwardADTaskRequestTests.java b/src/test/java/org/opensearch/ad/transport/ForwardADTaskRequestTests.java index 266b3b009..913fc64c0 100644 --- a/src/test/java/org/opensearch/ad/transport/ForwardADTaskRequestTests.java +++ b/src/test/java/org/opensearch/ad/transport/ForwardADTaskRequestTests.java @@ -85,7 +85,6 @@ public void testNullDetectorIdAndTaskAction() throws IOException { null, null, null, - null, null ); ForwardADTaskRequest request = new ForwardADTaskRequest(detector, null, null, null, null, Version.V_2_1_0); diff --git a/src/test/java/org/opensearch/ad/transport/ValidateAnomalyDetectorTransportActionTests.java b/src/test/java/org/opensearch/ad/transport/ValidateAnomalyDetectorTransportActionTests.java index 8550dce8a..80cef5a15 100644 --- a/src/test/java/org/opensearch/ad/transport/ValidateAnomalyDetectorTransportActionTests.java +++ b/src/test/java/org/opensearch/ad/transport/ValidateAnomalyDetectorTransportActionTests.java @@ -404,7 +404,6 @@ public void testValidateAnomalyDetectorWithInvalidDetectorName() throws IOExcept null, null, null, - null, null ); ingestTestDataValidate(anomalyDetector.getIndices().get(0), Instant.now().minus(1, ChronoUnit.DAYS), 1, "error"); @@ -453,7 +452,6 @@ public void testValidateAnomalyDetectorWithDetectorNameTooLong() throws IOExcept null, null, null, - null, null ); ingestTestDataValidate(anomalyDetector.getIndices().get(0), Instant.now().minus(1, ChronoUnit.DAYS), 1, "error"); diff --git a/src/test/java/org/opensearch/forecast/model/ForecasterTests.java b/src/test/java/org/opensearch/forecast/model/ForecasterTests.java index 380137345..dd31136ad 100644 --- a/src/test/java/org/opensearch/forecast/model/ForecasterTests.java +++ b/src/test/java/org/opensearch/forecast/model/ForecasterTests.java @@ -59,7 +59,6 @@ public class ForecasterTests extends AbstractTimeSeriesTest { Integer customResultIndexMinSize = null; Integer customResultIndexMinAge = null; Integer customResultIndexTTL = null; - Boolean flattenResultIndexMapping = null; public void testForecasterConstructor() { ImputationOption imputationOption = TestHelpers.randomImputationOption(features); @@ -89,8 +88,7 @@ public void testForecasterConstructor() { randomIntBetween(1, 1000), customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); assertEquals(forecasterId, forecaster.getId()); @@ -143,8 +141,7 @@ public void testForecasterConstructorWithNullForecastInterval() { randomIntBetween(1, 1000), customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); }); @@ -182,8 +179,7 @@ public void testNegativeInterval() { randomIntBetween(1, 1000), customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); }); @@ -221,8 +217,7 @@ public void testMaxCategoryFieldsLimits() { randomIntBetween(1, 1000), customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); }); @@ -260,8 +255,7 @@ public void testBlankName() { randomIntBetween(1, 1000), customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); }); @@ -299,8 +293,7 @@ public void testInvalidCustomResultIndex() { randomIntBetween(1, 1000), customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); }); @@ -337,8 +330,7 @@ public void testValidCustomResultIndex() { randomIntBetween(1, 1000), customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); assertEquals(resultIndex, forecaster.getCustomResultIndexOrAlias()); @@ -373,8 +365,7 @@ public void testInvalidHorizon() { randomIntBetween(1, 1000), customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); }); @@ -475,22 +466,4 @@ public void testValidCustomResultIndex_withIndexConditions() throws IOException Forecaster parsedForecaster = Forecaster.parse(TestHelpers.parser(forecasterString)); assertEquals(forecaster, parsedForecaster); } - - public void testParseNullCustomResultIndex_nullFlattenResultIndexMapping() throws IOException { - Forecaster forecaster = TestHelpers.ForecasterBuilder.newInstance().setFlattenResultIndexMapping(null).build(); - String forecasterString = TestHelpers - .xContentBuilderToString(forecaster.toXContent(TestHelpers.builder(), ToXContent.EMPTY_PARAMS)); - LOG.info(forecasterString); - Forecaster parsedForecaster = Forecaster.parse(TestHelpers.parser(forecasterString)); - assertEquals(forecaster, parsedForecaster); - } - - public void testValidCustomResultIndex_withFlattenResultIndexMapping() throws IOException { - Forecaster forecaster = TestHelpers.ForecasterBuilder.newInstance().setFlattenResultIndexMapping(true).build(); - String forecasterString = TestHelpers - .xContentBuilderToString(forecaster.toXContent(TestHelpers.builder(), ToXContent.EMPTY_PARAMS)); - LOG.info(forecasterString); - Forecaster parsedForecaster = Forecaster.parse(TestHelpers.parser(forecasterString)); - assertEquals(forecaster, parsedForecaster); - } } diff --git a/src/test/java/org/opensearch/timeseries/TestHelpers.java b/src/test/java/org/opensearch/timeseries/TestHelpers.java index 2c75febc0..99e2c7c64 100644 --- a/src/test/java/org/opensearch/timeseries/TestHelpers.java +++ b/src/test/java/org/opensearch/timeseries/TestHelpers.java @@ -339,7 +339,6 @@ public static AnomalyDetector randomAnomalyDetector( new ArrayList(), null, null, - null, null ); } @@ -394,7 +393,6 @@ public static AnomalyDetector randomDetector( null, null, null, - null, null ); } @@ -460,7 +458,6 @@ public static AnomalyDetector randomAnomalyDetectorUsingCategoryFields( null, null, null, - null, null ); } @@ -501,7 +498,6 @@ public static AnomalyDetector randomAnomalyDetector(String timefield, String ind null, null, null, - null, null ); } @@ -534,7 +530,6 @@ public static AnomalyDetector randomAnomalyDetectorWithEmptyFeature() throws IOE null, null, null, - null, null ); } @@ -574,7 +569,6 @@ public static AnomalyDetector randomAnomalyDetectorWithInterval(TimeConfiguratio null, null, null, - null, null ); } @@ -752,7 +746,6 @@ public AnomalyDetector build() { null, null, null, - null, null ); } @@ -789,7 +782,6 @@ public static AnomalyDetector randomAnomalyDetectorWithInterval(TimeConfiguratio null, null, null, - null, null ); } @@ -1772,7 +1764,6 @@ public static class ForecasterBuilder { Integer customResultIndexMinSize; Integer customResultIndexMinAge; Integer customResultIndexTTL; - Boolean flattenResultIndexMapping; ForecasterBuilder() throws IOException { forecasterId = randomAlphaOfLength(10); @@ -1797,7 +1788,6 @@ public static class ForecasterBuilder { customResultIndexMinSize = null; customResultIndexMinAge = null; customResultIndexTTL = null; - flattenResultIndexMapping = null; } public static ForecasterBuilder newInstance() throws IOException { @@ -1904,11 +1894,6 @@ public ForecasterBuilder setCustomResultIndexTTL(Integer customResultIndexTTL) { return this; } - public ForecasterBuilder setFlattenResultIndexMapping(Boolean flattenResultIndexMapping) { - this.flattenResultIndexMapping = flattenResultIndexMapping; - return this; - } - public ForecasterBuilder setNullImputationOption() { this.imputationOption = null; return this; @@ -1945,8 +1930,7 @@ public Forecaster build() { randomIntBetween(1, 1000), customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); } } @@ -1979,7 +1963,6 @@ public static Forecaster randomForecaster() throws IOException { randomIntBetween(1, 1000), null, null, - null, null ); }