diff --git a/flint-core/src/main/resources/async-query-scheduler-index-mapping.json b/flint-core/src/main/resources/async-query-scheduler-index-mapping.json new file mode 100644 index 000000000..6beee6f84 --- /dev/null +++ b/flint-core/src/main/resources/async-query-scheduler-index-mapping.json @@ -0,0 +1,60 @@ +{ + "dynamic": false, + "properties": { + "accountId": { + "type": "keyword" + }, + "jobId": { + "type": "keyword" + }, + "dataSource": { + "type": "keyword" + }, + "scheduledQuery": { + "type": "text" + }, + "queryLang": { + "type": "keyword" + }, + "lastUpdateTime": { + "type": "date", + "format": "epoch_millis" + }, + "enabledTime": { + "type": "date", + "format": "epoch_millis" + }, + "schedule": { + "properties": { + "initialDelay": { + "type": "long" + }, + "interval": { + "properties": { + "start_time": { + "type": "date", + "format": "strict_date_time||epoch_millis" + }, + "period": { + "type": "integer" + }, + "unit": { + "type": "keyword" + } + } + } + } + }, + "enabled": { + "type": "boolean" + }, + "lockDurationSeconds": { + "type": "long", + "null_value": -1 + }, + "jitter": { + "type": "double", + "null_value": 0.0 + } + } +} \ No newline at end of file diff --git a/flint-core/src/main/resources/async-query-scheduler-index-mapping.yml b/flint-core/src/main/resources/async-query-scheduler-index-mapping.yml deleted file mode 100644 index 1aa90e8ed..000000000 --- a/flint-core/src/main/resources/async-query-scheduler-index-mapping.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -## -# Copyright OpenSearch Contributors -# SPDX-License-Identifier: Apache-2.0 -## - -# Schema file for the .async-query-scheduler index -# Also "dynamic" is set to "false" so that other fields cannot be added. -dynamic: false -properties: - accountId: - type: keyword - jobId: - type: keyword - dataSource: - type: keyword - scheduledQuery: - type: text - queryLang: - type: keyword - lastUpdateTime: - type: date - format: epoch_millis - enabledTime: - type: date - format: epoch_millis - schedule: - properties: - initialDelay: - type: long - interval: - properties: - start_time: - type: date - format: "strict_date_time||epoch_millis" - period: - type: integer - unit: - type: keyword - enabled: - type: boolean - lockDurationSeconds: - type: long - null_value: -1 - jitter: - type: double - null_value: 0.0 \ No newline at end of file diff --git a/flint-core/src/main/resources/async-query-scheduler-index-settings.json b/flint-core/src/main/resources/async-query-scheduler-index-settings.json new file mode 100644 index 000000000..7041e27b8 --- /dev/null +++ b/flint-core/src/main/resources/async-query-scheduler-index-settings.json @@ -0,0 +1,7 @@ +{ + "index": { + "number_of_shards": "1", + "auto_expand_replicas": "0-2", + "number_of_replicas": "0" + } +} \ No newline at end of file diff --git a/flint-core/src/main/resources/async-query-scheduler-index-settings.yml b/flint-core/src/main/resources/async-query-scheduler-index-settings.yml deleted file mode 100644 index 386f1f4f3..000000000 --- a/flint-core/src/main/resources/async-query-scheduler-index-settings.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -## -# Copyright OpenSearch Contributors -# SPDX-License-Identifier: Apache-2.0 -## - -# Settings file for the .async-query-scheduler index -index: - number_of_shards: "1" - auto_expand_replicas: "0-2" - number_of_replicas: "0" \ No newline at end of file diff --git a/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/scheduler/OpenSearchAsyncQueryScheduler.java b/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/scheduler/OpenSearchAsyncQueryScheduler.java index 19532254b..42fcdea40 100644 --- a/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/scheduler/OpenSearchAsyncQueryScheduler.java +++ b/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/scheduler/OpenSearchAsyncQueryScheduler.java @@ -48,8 +48,8 @@ */ public class OpenSearchAsyncQueryScheduler implements AsyncQueryScheduler { public static final String SCHEDULER_INDEX_NAME = ".async-query-scheduler"; - private static final String SCHEDULER_INDEX_MAPPING_FILE_NAME = "async-query-scheduler-index-mapping.yml"; - private static final String SCHEDULER_INDEX_SETTINGS_FILE_NAME = "async-query-scheduler-index-settings.yml"; + private static final String SCHEDULER_INDEX_MAPPING_FILE_NAME = "async-query-scheduler-index-mapping.json"; + private static final String SCHEDULER_INDEX_SETTINGS_FILE_NAME = "async-query-scheduler-index-settings.json"; private static final Logger LOG = LogManager.getLogger(OpenSearchAsyncQueryScheduler.class); private static final ObjectMapper mapper = new ObjectMapper(); @@ -110,8 +110,8 @@ void createAsyncQuerySchedulerIndex(IRestHighLevelClient client) { InputStream settingsFileStream = getResourceAsStream(SCHEDULER_INDEX_SETTINGS_FILE_NAME)) { CreateIndexRequest createIndexRequest = new CreateIndexRequest(SCHEDULER_INDEX_NAME) - .mapping(IOUtils.toString(mappingFileStream, StandardCharsets.UTF_8), XContentType.YAML) - .settings(IOUtils.toString(settingsFileStream, StandardCharsets.UTF_8), XContentType.YAML); + .mapping(IOUtils.toString(mappingFileStream, StandardCharsets.UTF_8), XContentType.JSON) + .settings(IOUtils.toString(settingsFileStream, StandardCharsets.UTF_8), XContentType.JSON); CreateIndexResponse createIndexResponse = client.createIndex(createIndexRequest, RequestOptions.DEFAULT); if (!createIndexResponse.isAcknowledged()) {