Skip to content

Commit

Permalink
[Backport 2.x] Wrap CreateIndexRequest mappings in _doc key as requir…
Browse files Browse the repository at this point in the history
…ed (#814)

Wrap CreateIndexRequest mappings in _doc key as required (#809)

* Wrap CreateIndexRequest mappings in _doc key as required



* Add changelog/release notes



---------


(cherry picked from commit 834903f)

Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent a6cd332 commit 06a38b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)

### Bug Fixes
- Handle Not Found exceptions as successful deletions for agents and models ([#805](https://github.com/opensearch-project/flow-framework/pull/805))
- Wrap CreateIndexRequest mappings in _doc key as required ([#809](https://github.com/opensearch-project/flow-framework/pull/809))

### Infrastructure
### Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Compatible with OpenSearch 2.16.0

### Bug Fixes
- Handle Not Found deprovision exceptions as successful deletions ([#805](https://github.com/opensearch-project/flow-framework/pull/805))
- Wrap CreateIndexRequest mappings in _doc key as required ([#809](https://github.com/opensearch-project/flow-framework/pull/809))
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ 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("{\"_doc\":" + mapping + "}")
.settings(indexSettings);
client.admin().indices().create(request, actionListener);
} else {
logger.debug("index: {} is already created", indexName);
Expand Down

0 comments on commit 06a38b3

Please sign in to comment.