From 1813b4919f2f7824e0ff70a108d2f1132f53f61a Mon Sep 17 00:00:00 2001 From: Owais Kazi Date: Thu, 30 May 2024 14:20:15 -0700 Subject: [PATCH] Added workflow step for ReIndex Step (#718) * Initial commit for reindex workflow step with extra params Signed-off-by: owaiskazi19 * Addressed PR comments Signed-off-by: owaiskazi19 * Changed request per second to Float Signed-off-by: owaiskazi19 * Addressed string array for source indices and removed state index entry Signed-off-by: owaiskazi19 * Minor comments Signed-off-by: owaiskazi19 --------- Signed-off-by: owaiskazi19 --- CHANGELOG.md | 3 +++ .../flowframework/workflow/ReindexStep.java | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5021e3f14..6f4c568ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,10 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ### Features ### Enhancements - Add Workflow Step for Reindex from source index to destination ([#718](https://github.com/opensearch-project/flow-framework/pull/718)) +<<<<<<< HEAD - Add param to delete workflow API to clear status even if resources exist ([#719](https://github.com/opensearch-project/flow-framework/pull/719)) +======= +>>>>>>> 4ee2171 (Added workflow step for ReIndex Step (#718)) ### Bug Fixes - Add user mapping to Workflow State index ([#705](https://github.com/opensearch-project/flow-framework/pull/705)) diff --git a/src/main/java/org/opensearch/flowframework/workflow/ReindexStep.java b/src/main/java/org/opensearch/flowframework/workflow/ReindexStep.java index c0da6369c..b57723db0 100644 --- a/src/main/java/org/opensearch/flowframework/workflow/ReindexStep.java +++ b/src/main/java/org/opensearch/flowframework/workflow/ReindexStep.java @@ -13,6 +13,10 @@ import org.opensearch.ExceptionsHelper; import org.opensearch.action.support.PlainActionFuture; import org.opensearch.client.Client; +<<<<<<< HEAD +======= +import org.opensearch.common.Booleans; +>>>>>>> 4ee2171 (Added workflow step for ReIndex Step (#718)) import org.opensearch.core.action.ActionListener; import org.opensearch.core.common.Strings; import org.opensearch.core.rest.RestStatus; @@ -90,9 +94,17 @@ public PlainActionFuture execute( String sourceIndices = (String) inputs.get(SOURCE_INDEX); String destinationIndex = (String) inputs.get(DESTINATION_INDEX); +<<<<<<< HEAD Boolean refresh = ParseUtils.parseIfExists(inputs, REFRESH, Boolean.class); Float requestsPerSecond = ParseUtils.parseIfExists(inputs, REQUESTS_PER_SECOND, Float.class); Boolean requireAlias = ParseUtils.parseIfExists(inputs, REQUIRE_ALIAS, Boolean.class); +======= + Boolean refresh = inputs.containsKey(REFRESH) ? Booleans.parseBoolean(inputs.get(REFRESH).toString()) : null; + Float requestsPerSecond = inputs.containsKey(REQUESTS_PER_SECOND) + ? Float.parseFloat(inputs.get(REQUESTS_PER_SECOND).toString()) + : null; + Boolean requireAlias = inputs.containsKey(REQUIRE_ALIAS) ? Booleans.parseBoolean(inputs.get(REQUIRE_ALIAS).toString()) : null; +>>>>>>> 4ee2171 (Added workflow step for ReIndex Step (#718)) Integer slices = (Integer) inputs.get(SLICES); Integer maxDocs = (Integer) inputs.get(MAX_DOCS);