From 52679c34cc4ce01bd01e4b2a380cb27a9046e953 Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Thu, 17 Nov 2022 14:38:18 -0800 Subject: [PATCH] Removing unsupported dynamic_templates option for bulk (#276) * Removing unsupported dynamic_templates option Signed-off-by: Vacha Shah * Update CHANGELOG Signed-off-by: Vacha Shah Signed-off-by: Vacha Shah --- CHANGELOG.md | 2 +- .../opensearch/core/bulk/WriteOperation.java | 49 ------------------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 041f7f11d7..cb0fe002ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Deprecated ### Removed - +- Removed support for unsupported dynamic_templates in bulk ([#276](https://github.com/opensearch-project/opensearch-java/pull/276)) ### Fixed ### Security diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/bulk/WriteOperation.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/bulk/WriteOperation.java index f1547e5a31..8e102a10d8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/bulk/WriteOperation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/bulk/WriteOperation.java @@ -39,9 +39,7 @@ import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ApiTypeHelper; import jakarta.json.stream.JsonGenerator; -import java.util.Map; import javax.annotation.Nullable; // typedef: _global.bulk.WriteOperation @@ -49,7 +47,6 @@ public abstract class WriteOperation extends BulkOperationBase { - private final Map dynamicTemplates; @Nullable private final String pipeline; @@ -62,22 +59,11 @@ public abstract class WriteOperation extends BulkOperationBase { protected WriteOperation(AbstractBuilder builder) { super(builder); - this.dynamicTemplates = ApiTypeHelper.unmodifiable(builder.dynamicTemplates); this.pipeline = builder.pipeline; this.requireAlias = builder.requireAlias; } - /** - * API name: {@code dynamic_templates} - */ - public final Map dynamicTemplates() { - return this.dynamicTemplates; - } - - /** - * API name: {@code pipeline} - */ @Nullable public final String pipeline() { return this.pipeline; @@ -94,17 +80,6 @@ public final Boolean requireAlias() { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); - if (ApiTypeHelper.isDefined(this.dynamicTemplates)) { - generator.writeKey("dynamic_templates"); - generator.writeStartObject(); - for (Map.Entry item0 : this.dynamicTemplates.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } if (this.pipeline != null) { generator.writeKey("pipeline"); generator.write(this.pipeline); @@ -121,8 +96,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { protected abstract static class AbstractBuilder> extends BulkOperationBase.AbstractBuilder { - @Nullable - private Map dynamicTemplates; @Nullable private String pipeline; @@ -130,26 +103,6 @@ protected abstract static class AbstractBuilder - * Adds all entries of map to dynamicTemplates. - */ - public final BuilderT dynamicTemplates(Map map) { - this.dynamicTemplates = _mapPutAll(this.dynamicTemplates, map); - return self(); - } - - /** - * API name: {@code dynamic_templates} - *

- * Adds an entry to dynamicTemplates. - */ - public final BuilderT dynamicTemplates(String key, String value) { - this.dynamicTemplates = _mapPut(this.dynamicTemplates, key, value); - return self(); - } - /** * API name: {@code pipeline} */ @@ -172,8 +125,6 @@ public final BuilderT requireAlias(@Nullable Boolean value) { protected static > void setupWriteOperationDeserializer( ObjectDeserializer op) { BulkOperationBase.setupBulkOperationBaseDeserializer(op); - op.add(AbstractBuilder::dynamicTemplates, - JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "dynamic_templates"); op.add(AbstractBuilder::pipeline, JsonpDeserializer.stringDeserializer(), "pipeline"); op.add(AbstractBuilder::requireAlias, JsonpDeserializer.booleanDeserializer(), "require_alias");