diff --git a/src/main/java/org/opensearch/ad/model/ADTask.java b/src/main/java/org/opensearch/ad/model/ADTask.java index dbfd42d34..6e903ac89 100644 --- a/src/main/java/org/opensearch/ad/model/ADTask.java +++ b/src/main/java/org/opensearch/ad/model/ADTask.java @@ -345,7 +345,6 @@ public static ADTask parse(XContentParser parser, String taskId) throws IOExcept detector.getCustomResultIndexMinSize(), detector.getCustomResultIndexMinAge(), detector.getCustomResultIndexTTL(), - detector.getFlattenResultIndexMapping(), detector.getLastBreakingUIChangeTime() ); return new Builder() diff --git a/src/main/java/org/opensearch/ad/model/AnomalyDetector.java b/src/main/java/org/opensearch/ad/model/AnomalyDetector.java index 2572299b1..a35949454 100644 --- a/src/main/java/org/opensearch/ad/model/AnomalyDetector.java +++ b/src/main/java/org/opensearch/ad/model/AnomalyDetector.java @@ -152,7 +152,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 * @param lastBreakingUIChangeTime last update time to configuration that can break UI and we have * to display updates from the changed time */ @@ -182,7 +181,6 @@ public AnomalyDetector( Integer customResultIndexMinSize, Integer customResultIndexMinAge, Integer customResultIndexTTL, - Boolean flattenResultIndexMapping, Instant lastBreakingUIChangeTime ) { super( @@ -211,7 +209,6 @@ public AnomalyDetector( customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastBreakingUIChangeTime ); @@ -291,7 +288,6 @@ public AnomalyDetector(StreamInput input) throws IOException { this.customResultIndexMinSize = input.readOptionalInt(); this.customResultIndexMinAge = input.readOptionalInt(); this.customResultIndexTTL = input.readOptionalInt(); - this.flattenResultIndexMapping = input.readOptionalBoolean(); this.lastUIBreakingChangeTime = input.readOptionalInstant(); } @@ -358,7 +354,6 @@ public void writeTo(StreamOutput output) throws IOException { output.writeOptionalInt(customResultIndexMinSize); output.writeOptionalInt(customResultIndexMinAge); output.writeOptionalInt(customResultIndexTTL); - output.writeOptionalBoolean(flattenResultIndexMapping); output.writeOptionalInstant(lastUIBreakingChangeTime); } @@ -456,7 +451,6 @@ public static AnomalyDetector parse( Integer customResultIndexMinSize = null; Integer customResultIndexMinAge = null; Integer customResultIndexTTL = null; - Boolean flattenResultIndexMapping = null; Instant lastBreakingUIChangeTime = null; ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser); @@ -592,9 +586,6 @@ public static AnomalyDetector parse( case RESULT_INDEX_FIELD_TTL: customResultIndexTTL = onlyParseNumberValue(parser); break; - case FLATTEN_RESULT_INDEX_MAPPING: - flattenResultIndexMapping = onlyParseBooleanValue(parser); - break; case BREAKING_UI_CHANGE_TIME: lastBreakingUIChangeTime = ParseUtils.toInstant(parser); break; @@ -629,7 +620,6 @@ public static AnomalyDetector parse( customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastBreakingUIChangeTime ); detector.setDetectionDateRange(detectionDateRange); @@ -718,13 +708,6 @@ 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; - } - /** * Validates each condition in the list of rules against the list of features. * Checks that: 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 13f70c840..7242cf7c6 100644 --- a/src/main/java/org/opensearch/ad/rest/handler/AbstractAnomalyDetectorActionHandler.java +++ b/src/main/java/org/opensearch/ad/rest/handler/AbstractAnomalyDetectorActionHandler.java @@ -245,7 +245,6 @@ protected AnomalyDetector copyConfig(User user, Config config) { config.getCustomResultIndexMinSize(), config.getCustomResultIndexMinAge(), config.getCustomResultIndexTTL(), - config.getFlattenResultIndexMapping(), breakingUIChange ? Instant.now() : config.getLastBreakingUIChangeTime() ); } diff --git a/src/main/java/org/opensearch/forecast/model/ForecastTask.java b/src/main/java/org/opensearch/forecast/model/ForecastTask.java index 3fb2e515a..e5684cabd 100644 --- a/src/main/java/org/opensearch/forecast/model/ForecastTask.java +++ b/src/main/java/org/opensearch/forecast/model/ForecastTask.java @@ -1,9 +1,6 @@ /* -<<<<<<< HEAD * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 -======= - * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a @@ -11,7 +8,6 @@ * * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. ->>>>>>> f22eaa95 (test) */ package org.opensearch.forecast.model; @@ -343,7 +339,6 @@ public static ForecastTask parse(XContentParser parser, String taskId) throws IO forecaster.getCustomResultIndexMinSize(), forecaster.getCustomResultIndexMinAge(), forecaster.getCustomResultIndexTTL(), - forecaster.getFlattenResultIndexMapping(), forecaster.getLastBreakingUIChangeTime() ); return new Builder() diff --git a/src/main/java/org/opensearch/forecast/model/Forecaster.java b/src/main/java/org/opensearch/forecast/model/Forecaster.java index 756b5c4e0..c98a4080c 100644 --- a/src/main/java/org/opensearch/forecast/model/Forecaster.java +++ b/src/main/java/org/opensearch/forecast/model/Forecaster.java @@ -135,7 +135,6 @@ public Forecaster( Integer customResultIndexMinSize, Integer customResultIndexMinAge, Integer customResultIndexTTL, - Boolean flattenResultIndexMapping, Instant lastBreakingUIChangeTime ) { super( @@ -164,7 +163,6 @@ public Forecaster( customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastBreakingUIChangeTime ); @@ -307,7 +305,6 @@ public static Forecaster parse( Integer customResultIndexMinSize = null; Integer customResultIndexMinAge = null; Integer customResultIndexTTL = null; - Boolean flattenResultIndexMapping = null; Instant lastBreakingUIChangeTime = null; ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser); @@ -437,9 +434,6 @@ public static Forecaster parse( case RESULT_INDEX_FIELD_TTL: customResultIndexTTL = parser.intValue(); break; - case FLATTEN_RESULT_INDEX_MAPPING: - flattenResultIndexMapping = parser.booleanValue(); - break; case BREAKING_UI_CHANGE_TIME: lastBreakingUIChangeTime = ParseUtils.toInstant(parser); break; @@ -474,7 +468,6 @@ public static Forecaster parse( customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastBreakingUIChangeTime ); 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 01edc14ef..b631a45f2 100644 --- a/src/main/java/org/opensearch/forecast/rest/handler/AbstractForecasterActionHandler.java +++ b/src/main/java/org/opensearch/forecast/rest/handler/AbstractForecasterActionHandler.java @@ -258,7 +258,6 @@ protected Config copyConfig(User user, Config config) { config.getCustomResultIndexMinSize(), config.getCustomResultIndexMinAge(), config.getCustomResultIndexTTL(), - config.getFlattenResultIndexMapping(), breakingUIChange ? Instant.now() : config.getLastBreakingUIChangeTime() ); } diff --git a/src/main/java/org/opensearch/timeseries/model/Config.java b/src/main/java/org/opensearch/timeseries/model/Config.java index d61807528..7895428db 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"; // Changing categorical field, feature attributes, interval, windowDelay, time field, horizon, indices, // result index would force us to display results only from the most recent update. Otherwise, // the UI appear cluttered and unclear. @@ -124,7 +123,6 @@ public abstract class Config implements Writeable, ToXContentObject { protected Integer customResultIndexMinSize; protected Integer customResultIndexMinAge; protected Integer customResultIndexTTL; - protected Boolean flattenResultIndexMapping; protected Instant lastUIBreakingChangeTime; public static String INVALID_RESULT_INDEX_NAME_SIZE = "Result index name size must contains less than " @@ -157,7 +155,6 @@ protected Config( Integer customResultIndexMinSize, Integer customResultIndexMinAge, Integer customResultIndexTTL, - Boolean flattenResultIndexMapping, Instant lastBreakingUIChangeTime ) { if (Strings.isBlank(name)) { @@ -297,7 +294,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; this.lastUIBreakingChangeTime = lastBreakingUIChangeTime; } @@ -342,7 +338,6 @@ public Config(StreamInput input) throws IOException { this.customResultIndexMinSize = input.readOptionalInt(); this.customResultIndexMinAge = input.readOptionalInt(); this.customResultIndexTTL = input.readOptionalInt(); - this.flattenResultIndexMapping = input.readOptionalBoolean(); this.lastUIBreakingChangeTime = input.readOptionalInstant(); } @@ -396,7 +391,6 @@ public void writeTo(StreamOutput output) throws IOException { output.writeOptionalInt(customResultIndexMinSize); output.writeOptionalInt(customResultIndexMinAge); output.writeOptionalInt(customResultIndexTTL); - output.writeOptionalBoolean(flattenResultIndexMapping); output.writeOptionalInstant(lastUIBreakingChangeTime); } @@ -454,8 +448,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 @@ -482,8 +475,7 @@ public int hashCode() { historyIntervals, customResultIndexMinSize, customResultIndexMinAge, - customResultIndexTTL, - flattenResultIndexMapping + customResultIndexTTL ); } @@ -532,9 +524,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); - } if (lastUIBreakingChangeTime != null) { builder.field(BREAKING_UI_CHANGE_TIME, lastUIBreakingChangeTime.toEpochMilli()); } @@ -746,10 +735,6 @@ public Integer getCustomResultIndexTTL() { return customResultIndexTTL; } - public Boolean getFlattenResultIndexMapping() { - return flattenResultIndexMapping; - } - public Instant getLastBreakingUIChangeTime() { return lastUIBreakingChangeTime; } @@ -806,7 +791,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/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java b/src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java index 257b8d5d9..7712957d2 100644 --- a/src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java +++ b/src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java @@ -859,7 +859,6 @@ public void doE detector.getCustomResultIndexMinSize(), detector.getCustomResultIndexMinAge(), detector.getCustomResultIndexTTL(), - detector.getFlattenResultIndexMapping(), Instant.now() ); try { diff --git a/src/test/java/org/opensearch/ad/AnomalyDetectorRestTestCase.java b/src/test/java/org/opensearch/ad/AnomalyDetectorRestTestCase.java index 35c3aeb3c..f136d05dc 100644 --- a/src/test/java/org/opensearch/ad/AnomalyDetectorRestTestCase.java +++ b/src/test/java/org/opensearch/ad/AnomalyDetectorRestTestCase.java @@ -314,7 +314,6 @@ public ToXContentObject[] getConfig(String detectorId, BasicHeader header, boole detector.getCustomResultIndexMinSize(), detector.getCustomResultIndexMinAge(), detector.getCustomResultIndexTTL(), - detector.getFlattenResultIndexMapping(), detector.getLastBreakingUIChangeTime() ), detectorJob, @@ -584,7 +583,6 @@ protected AnomalyDetector cloneDetector(AnomalyDetector anomalyDetector, String anomalyDetector.getCustomResultIndexMinSize(), anomalyDetector.getCustomResultIndexMinAge(), anomalyDetector.getCustomResultIndexTTL(), - anomalyDetector.getFlattenResultIndexMapping(), Instant.now() ); 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 902edb949..d87f3b40e 100644 --- a/src/test/java/org/opensearch/ad/model/AnomalyDetectorTests.java +++ b/src/test/java/org/opensearch/ad/model/AnomalyDetectorTests.java @@ -345,7 +345,6 @@ public void testInvalidShingleSize() throws Exception { null, null, null, - null, Instant.now() ) ); @@ -383,7 +382,6 @@ public void testNullDetectorName() throws Exception { null, null, null, - null, Instant.now() ) ); @@ -421,7 +419,6 @@ public void testBlankDetectorName() throws Exception { null, null, null, - null, Instant.now() ) ); @@ -459,7 +456,6 @@ public void testNullTimeField() throws Exception { null, null, null, - null, Instant.now() ) ); @@ -497,7 +493,6 @@ public void testNullIndices() throws Exception { null, null, null, - null, Instant.now() ) ); @@ -535,7 +530,6 @@ public void testEmptyIndices() throws Exception { null, null, null, - null, Instant.now() ) ); @@ -573,7 +567,6 @@ public void testNullDetectionInterval() throws Exception { null, null, null, - null, Instant.now() ) ); @@ -610,7 +603,6 @@ public void testInvalidRecency() { null, null, null, - null, Instant.now() ) ); @@ -648,7 +640,6 @@ public void testInvalidDetectionInterval() { null, null, null, - null, Instant.now() ) ); @@ -686,7 +677,6 @@ public void testInvalidWindowDelay() { null, null, null, - null, Instant.now() ) ); @@ -737,7 +727,6 @@ public void testGetShingleSize() throws IOException { null, null, null, - null, Instant.now() ); assertEquals((int) anomalyDetector.getShingleSize(), 5); @@ -773,7 +762,6 @@ public void testGetShingleSizeReturnsDefaultValue() throws IOException { null, null, null, - null, Instant.now() ); // seasonalityIntervals is not null and custom shingle size is null, use seasonalityIntervals to deterine shingle size @@ -805,7 +793,6 @@ public void testGetShingleSizeReturnsDefaultValue() throws IOException { null, null, null, - null, Instant.now() ); // seasonalityIntervals is null and custom shingle size is null, use default shingle size @@ -839,7 +826,6 @@ public void testNullFeatureAttributes() throws IOException { null, null, null, - null, Instant.now() ); assertNotNull(anomalyDetector.getFeatureAttributes()); @@ -873,7 +859,6 @@ public void testValidateResultIndex() throws IOException { null, null, null, - null, Instant.now() ); String errorMessage = anomalyDetector.validateCustomResultIndex("abc"); @@ -962,21 +947,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\":true," - + "\"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\":\"FIXED_VALUES\",\"default_fill\"" - + ":[{\"feature_name\":\"eYYCM\", \"data\": 3}]},\"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) -> { @@ -1041,7 +1011,6 @@ public void testNullFixedValue() throws IOException { null, null, null, - null, Instant.now() ) ); diff --git a/src/test/java/org/opensearch/ad/rest/ADRestTestUtils.java b/src/test/java/org/opensearch/ad/rest/ADRestTestUtils.java index 90634347d..0ac0418ee 100644 --- a/src/test/java/org/opensearch/ad/rest/ADRestTestUtils.java +++ b/src/test/java/org/opensearch/ad/rest/ADRestTestUtils.java @@ -226,7 +226,6 @@ public static Response createAnomalyDetector( null, null, null, - null, now ); diff --git a/src/test/java/org/opensearch/ad/rest/AnomalyDetectorRestApiIT.java b/src/test/java/org/opensearch/ad/rest/AnomalyDetectorRestApiIT.java index 1a2007e69..df8e1e034 100644 --- a/src/test/java/org/opensearch/ad/rest/AnomalyDetectorRestApiIT.java +++ b/src/test/java/org/opensearch/ad/rest/AnomalyDetectorRestApiIT.java @@ -160,7 +160,6 @@ public void testCreateAnomalyDetectorWithDuplicateName() throws Exception { null, null, null, - null, null ); @@ -290,7 +289,6 @@ public void testUpdateAnomalyDetectorCategoryField() throws Exception { null, null, null, - null, detector.getLastBreakingUIChangeTime() ); Exception ex = expectThrows( @@ -358,7 +356,6 @@ public void testUpdateAnomalyDetector() throws Exception { null, null, null, - null, detector.getLastBreakingUIChangeTime() ); @@ -431,7 +428,6 @@ public void testUpdateAnomalyDetectorNameToExisting() throws Exception { null, null, null, - null, detector1.getLastBreakingUIChangeTime() ); @@ -481,7 +477,6 @@ public void testUpdateAnomalyDetectorNameToNew() throws Exception { null, null, null, - null, Instant.now() ); @@ -537,7 +532,6 @@ public void testUpdateAnomalyDetectorWithNotExistingIndex() throws Exception { null, null, null, - null, detector.getLastBreakingUIChangeTime() ); @@ -923,7 +917,6 @@ public void testUpdateAnomalyDetectorWithRunningAdJob() throws Exception { null, null, null, - null, detector.getLastBreakingUIChangeTime() ); diff --git a/src/test/java/org/opensearch/ad/rest/HistoricalAnalysisRestApiIT.java b/src/test/java/org/opensearch/ad/rest/HistoricalAnalysisRestApiIT.java index 3a437e02d..dce587cd3 100644 --- a/src/test/java/org/opensearch/ad/rest/HistoricalAnalysisRestApiIT.java +++ b/src/test/java/org/opensearch/ad/rest/HistoricalAnalysisRestApiIT.java @@ -349,7 +349,6 @@ private AnomalyDetector randomAnomalyDetector(AnomalyDetector detector) { detector.getCustomResultIndexMinSize(), detector.getCustomResultIndexMinAge(), detector.getCustomResultIndexTTL(), - detector.getFlattenResultIndexMapping(), detector.getLastBreakingUIChangeTime() ); } diff --git a/src/test/java/org/opensearch/ad/rest/SecureADRestIT.java b/src/test/java/org/opensearch/ad/rest/SecureADRestIT.java index f786bc9ae..589a7df5b 100644 --- a/src/test/java/org/opensearch/ad/rest/SecureADRestIT.java +++ b/src/test/java/org/opensearch/ad/rest/SecureADRestIT.java @@ -264,7 +264,6 @@ public void testUpdateApiFilterByEnabledForAdmin() throws IOException { null, null, null, - null, Instant.now() ); // User client has admin all access, and has "opensearch" backend role so client should be able to update detector @@ -320,7 +319,6 @@ public void testUpdateApiFilterByEnabled() throws IOException { null, null, null, - null, Instant.now() ); enableFilterBy(); diff --git a/src/test/java/org/opensearch/ad/transport/AnomalyResultTransportActionTests.java b/src/test/java/org/opensearch/ad/transport/AnomalyResultTransportActionTests.java index b3d30d5cb..ac530dbe7 100644 --- a/src/test/java/org/opensearch/ad/transport/AnomalyResultTransportActionTests.java +++ b/src/test/java/org/opensearch/ad/transport/AnomalyResultTransportActionTests.java @@ -227,7 +227,6 @@ private AnomalyDetector randomDetector(List indices, List featu null, null, null, - null, Instant.now() ); } @@ -259,7 +258,6 @@ private AnomalyDetector randomHCDetector(List indices, List fea null, null, null, - null, Instant.now() ); } diff --git a/src/test/java/org/opensearch/ad/transport/ForwardADTaskRequestTests.java b/src/test/java/org/opensearch/ad/transport/ForwardADTaskRequestTests.java index f5be130a1..33aa08186 100644 --- a/src/test/java/org/opensearch/ad/transport/ForwardADTaskRequestTests.java +++ b/src/test/java/org/opensearch/ad/transport/ForwardADTaskRequestTests.java @@ -86,7 +86,6 @@ public void testNullDetectorIdAndTaskAction() throws IOException { null, null, null, - null, Instant.now() ); 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 9a57c6a5e..aa0e53842 100644 --- a/src/test/java/org/opensearch/ad/transport/ValidateAnomalyDetectorTransportActionTests.java +++ b/src/test/java/org/opensearch/ad/transport/ValidateAnomalyDetectorTransportActionTests.java @@ -405,7 +405,6 @@ public void testValidateAnomalyDetectorWithInvalidDetectorName() throws IOExcept null, null, null, - null, Instant.now() ); ingestTestDataValidate(anomalyDetector.getIndices().get(0), Instant.now().minus(1, ChronoUnit.DAYS), 1, "error"); @@ -455,7 +454,6 @@ public void testValidateAnomalyDetectorWithDetectorNameTooLong() throws IOExcept null, null, null, - null, Instant.now() ); 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 b8719360d..049772668 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); @@ -90,7 +89,6 @@ public void testForecasterConstructor() { customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastUpdateTime ); @@ -145,7 +143,6 @@ public void testForecasterConstructorWithNullForecastInterval() { customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastUpdateTime ); }); @@ -185,7 +182,6 @@ public void testNegativeInterval() { customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastUpdateTime ); }); @@ -225,7 +221,6 @@ public void testMaxCategoryFieldsLimits() { customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastUpdateTime ); }); @@ -265,7 +260,6 @@ public void testBlankName() { customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastUpdateTime ); }); @@ -305,7 +299,6 @@ public void testInvalidCustomResultIndex() { customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastUpdateTime ); }); @@ -344,7 +337,6 @@ public void testValidCustomResultIndex() { customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastUpdateTime ); @@ -381,7 +373,6 @@ public void testInvalidHorizon() { customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastUpdateTime ); }); @@ -483,22 +474,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 7e4a0b7d0..60d09fef4 100644 --- a/src/test/java/org/opensearch/timeseries/TestHelpers.java +++ b/src/test/java/org/opensearch/timeseries/TestHelpers.java @@ -340,7 +340,6 @@ public static AnomalyDetector randomAnomalyDetector( null, null, null, - null, lastUpdateTime ); } @@ -396,7 +395,6 @@ public static AnomalyDetector randomDetector( null, null, null, - null, Instant.now() ); } @@ -463,7 +461,6 @@ public static AnomalyDetector randomAnomalyDetectorUsingCategoryFields( null, null, null, - null, Instant.now() ); } @@ -505,7 +502,6 @@ public static AnomalyDetector randomAnomalyDetector(String timefield, String ind null, null, null, - null, Instant.now() ); } @@ -539,7 +535,6 @@ public static AnomalyDetector randomAnomalyDetectorWithEmptyFeature() throws IOE null, null, null, - null, Instant.now().truncatedTo(ChronoUnit.SECONDS) ); } @@ -580,7 +575,6 @@ public static AnomalyDetector randomAnomalyDetectorWithInterval(TimeConfiguratio null, null, null, - null, Instant.now().truncatedTo(ChronoUnit.SECONDS) ); } @@ -759,7 +753,6 @@ public AnomalyDetector build() { null, null, null, - null, lastUpdateTime ); } @@ -797,7 +790,6 @@ public static AnomalyDetector randomAnomalyDetectorWithInterval(TimeConfiguratio null, null, null, - null, Instant.now().truncatedTo(ChronoUnit.SECONDS) ); } @@ -1780,7 +1772,6 @@ public static class ForecasterBuilder { Integer customResultIndexMinSize; Integer customResultIndexMinAge; Integer customResultIndexTTL; - Boolean flattenResultIndexMapping; ForecasterBuilder() throws IOException { forecasterId = randomAlphaOfLength(10); @@ -1805,7 +1796,6 @@ public static class ForecasterBuilder { customResultIndexMinSize = null; customResultIndexMinAge = null; customResultIndexTTL = null; - flattenResultIndexMapping = null; } public static ForecasterBuilder newInstance() throws IOException { @@ -1912,11 +1902,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; @@ -1955,7 +1940,6 @@ public Forecaster build() { customResultIndexMinSize, customResultIndexMinAge, customResultIndexTTL, - flattenResultIndexMapping, lastUpdateTime ); } @@ -1991,7 +1975,6 @@ public static Forecaster randomForecaster() throws IOException { null, null, null, - null, Instant.now().truncatedTo(ChronoUnit.SECONDS) ); }