diff --git a/CHANGELOG.md b/CHANGELOG.md index dbc57cbe9..129e0cf04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) - Register system index descriptors through SystemIndexPlugin.getSystemIndexDescriptors ([#750](https://github.com/opensearch-project/flow-framework/pull/750)) ### Bug Fixes +- Initialize all shards on index creation to avoid mapping conflicts ([#799](https://github.com/opensearch-project/flow-framework/pull/799)) + ### Infrastructure ### Documentation diff --git a/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java b/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java index 18f0a9780..a4ac85a19 100644 --- a/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java +++ b/src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java @@ -20,6 +20,7 @@ import org.opensearch.action.get.GetRequest; import org.opensearch.action.index.IndexRequest; import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.ActiveShardCount; import org.opensearch.action.support.WriteRequest; import org.opensearch.action.update.UpdateRequest; import org.opensearch.action.update.UpdateResponse; @@ -193,7 +194,9 @@ public void initFlowFrameworkIndexIfAbsent(FlowFrameworkIndex index, ActionListe logger.error(errorMessage, e); internalListener.onFailure(new FlowFrameworkException(errorMessage, ExceptionsHelper.status(e))); }); - CreateIndexRequest request = new CreateIndexRequest(indexName).mapping(mapping).settings(indexSettings); + CreateIndexRequest request = new CreateIndexRequest(indexName).mapping(mapping) + .settings(indexSettings) + .waitForActiveShards(ActiveShardCount.ALL); client.admin().indices().create(request, actionListener); } else { logger.debug("index: {} is already created", indexName);