From b0cca39e15df8b6bf1cd90235610e9323a97a4b2 Mon Sep 17 00:00:00 2001 From: Andre Kurait Date: Tue, 10 Dec 2024 13:07:19 -0600 Subject: [PATCH] Add NONE multiTypeResolutionBehavior Signed-off-by: Andre Kurait --- .../transformation/rules/IndexMappingTypeRemoval.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/transformation/src/main/java/org/opensearch/migrations/transformation/rules/IndexMappingTypeRemoval.java b/transformation/src/main/java/org/opensearch/migrations/transformation/rules/IndexMappingTypeRemoval.java index a4366bffb..5485462ac 100644 --- a/transformation/src/main/java/org/opensearch/migrations/transformation/rules/IndexMappingTypeRemoval.java +++ b/transformation/src/main/java/org/opensearch/migrations/transformation/rules/IndexMappingTypeRemoval.java @@ -53,9 +53,9 @@ public enum MultiTypeResolutionBehavior { private static final ObjectMapper MAPPER = new ObjectMapper(); public final MultiTypeResolutionBehavior multiTypeResolutionBehavior; - // Default with SPLIT + // Default with NONE public IndexMappingTypeRemoval() { - this(MultiTypeResolutionBehavior.SPLIT); + this(MultiTypeResolutionBehavior.NONE); } @Override @@ -76,6 +76,9 @@ public CanApplyResult canApply(final Index index) { // 1.
{"mappings": [{ "foo": {...} }, { "bar": {...} }]}
// 2.
{"mappings": [{ "foo": {...}, "bar": {...}  }]}
if (mappingNode.isArray() && (mappingNode.size() > 1 || mappingNode.get(0).size() > 1)) { + if (MultiTypeResolutionBehavior.NONE.equals(multiTypeResolutionBehavior)) { + return new Unsupported("No multi type resolution behavior declared"); + } if (MultiTypeResolutionBehavior.SPLIT.equals(multiTypeResolutionBehavior)) { return new Unsupported("Split on multiple mapping types is not supported"); }