From 115369a65d59bdf322e47d9ffc925e301720912f Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Tue, 8 Aug 2023 21:08:08 +0000 Subject: [PATCH] Removing unsupported fields from PutMappingRequest Signed-off-by: Vacha Shah --- .../opensearch/indices/PutMappingRequest.java | 471 ------------------ 1 file changed, 471 deletions(-) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java index 53d45e8193..883f2564e3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java @@ -36,14 +36,7 @@ import org.opensearch.client.opensearch._types.ExpandWildcard; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.Time; -import org.opensearch.client.opensearch._types.mapping.DynamicMapping; -import org.opensearch.client.opensearch._types.mapping.DynamicTemplate; -import org.opensearch.client.opensearch._types.mapping.FieldNamesField; import org.opensearch.client.opensearch._types.mapping.Property; -import org.opensearch.client.opensearch._types.mapping.RoutingField; -import org.opensearch.client.opensearch._types.mapping.RuntimeField; -import org.opensearch.client.opensearch._types.mapping.SourceField; -import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -72,30 +65,9 @@ */ @JsonpDeserializable public class PutMappingRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final FieldNamesField fieldNames; - - private final Map meta; - - @Nullable - private final RoutingField routing; - - @Nullable - private final SourceField source; - @Nullable private final Boolean allowNoIndices; - @Nullable - private final Boolean dateDetection; - - @Nullable - private final DynamicMapping dynamic; - - private final List dynamicDateFormats; - - private final List> dynamicTemplates; - private final List expandWildcards; @Nullable @@ -110,13 +82,8 @@ public class PutMappingRequest extends RequestBase implements JsonpSerializable @Nullable private final Time clusterManagerTimeout; - @Nullable - private final Boolean numericDetection; - private final Map properties; - private final Map runtime; - @Nullable private final Time timeout; @@ -127,23 +94,13 @@ public class PutMappingRequest extends RequestBase implements JsonpSerializable private PutMappingRequest(Builder builder) { - this.fieldNames = builder.fieldNames; - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.routing = builder.routing; - this.source = builder.source; this.allowNoIndices = builder.allowNoIndices; - this.dateDetection = builder.dateDetection; - this.dynamic = builder.dynamic; - this.dynamicDateFormats = ApiTypeHelper.unmodifiable(builder.dynamicDateFormats); - this.dynamicTemplates = ApiTypeHelper.unmodifiable(builder.dynamicTemplates); this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; - this.numericDetection = builder.numericDetection; this.properties = ApiTypeHelper.unmodifiable(builder.properties); - this.runtime = ApiTypeHelper.unmodifiable(builder.runtime); this.timeout = builder.timeout; this.writeIndexOnly = builder.writeIndexOnly; @@ -153,47 +110,6 @@ public static PutMappingRequest of(Function - * API name: {@code _field_names} - */ - @Nullable - public final FieldNamesField fieldNames() { - return this.fieldNames; - } - - /** - * A mapping type can have custom meta data associated with it. These are not - * used at all by Elasticsearch, but can be used to store application-specific - * metadata. - *

- * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * Enable making a routing value required on indexed documents. - *

- * API name: {@code _routing} - */ - @Nullable - public final RoutingField routing() { - return this.routing; - } - - /** - * Control whether the _source field is enabled on the index. - *

- * API name: {@code _source} - */ - @Nullable - public final SourceField source() { - return this.source; - } - /** * Whether to ignore if a wildcard indices expression resolves into no concrete * indices. (This includes _all string or when no indices have been @@ -206,46 +122,6 @@ public final Boolean allowNoIndices() { return this.allowNoIndices; } - /** - * Controls whether dynamic date detection is enabled. - *

- * API name: {@code date_detection} - */ - @Nullable - public final Boolean dateDetection() { - return this.dateDetection; - } - - /** - * Controls whether new fields are added dynamically. - *

- * API name: {@code dynamic} - */ - @Nullable - public final DynamicMapping dynamic() { - return this.dynamic; - } - - /** - * If date detection is enabled then new string fields are checked against - * 'dynamic_date_formats' and if the value matches then a new date field is - * added instead of string. - *

- * API name: {@code dynamic_date_formats} - */ - public final List dynamicDateFormats() { - return this.dynamicDateFormats; - } - - /** - * Specify dynamic templates for the mapping. - *

- * API name: {@code dynamic_templates} - */ - public final List> dynamicTemplates() { - return this.dynamicTemplates; - } - /** * Whether to expand wildcard expression to concrete indices that are open, * closed or both. @@ -299,16 +175,6 @@ public final Time clusterManagerTimeout() { return this.clusterManagerTimeout; } - /** - * Automatically map strings into numeric data types for all fields. - *

- * API name: {@code numeric_detection} - */ - @Nullable - public final Boolean numericDetection() { - return this.numericDetection; - } - /** * Mapping for a field. For new fields, this mapping can include: *

    @@ -323,15 +189,6 @@ public final Map properties() { return this.properties; } - /** - * Mapping of runtime fields for the index. - *

    - * API name: {@code runtime} - */ - public final Map runtime() { - return this.runtime; - } - /** * Explicit operation timeout *

    @@ -363,75 +220,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.fieldNames != null) { - generator.writeKey("_field_names"); - this.fieldNames.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.meta)) { - generator.writeKey("_meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.routing != null) { - generator.writeKey("_routing"); - this.routing.serialize(generator, mapper); - - } - if (this.source != null) { - generator.writeKey("_source"); - this.source.serialize(generator, mapper); - - } - if (this.dateDetection != null) { - generator.writeKey("date_detection"); - generator.write(this.dateDetection); - - } - if (this.dynamic != null) { - generator.writeKey("dynamic"); - this.dynamic.serialize(generator, mapper); - } - if (ApiTypeHelper.isDefined(this.dynamicDateFormats)) { - generator.writeKey("dynamic_date_formats"); - generator.writeStartArray(); - for (String item0 : this.dynamicDateFormats) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.dynamicTemplates)) { - generator.writeKey("dynamic_templates"); - generator.writeStartArray(); - for (Map item0 : this.dynamicTemplates) { - generator.writeStartObject(); - if (item0 != null) { - for (Map.Entry item1 : item0.entrySet()) { - generator.writeKey(item1.getKey()); - item1.getValue().serialize(generator, mapper); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - if (this.numericDetection != null) { - generator.writeKey("numeric_detection"); - generator.write(this.numericDetection); - - } if (ApiTypeHelper.isDefined(this.properties)) { generator.writeKey("properties"); generator.writeStartObject(); @@ -443,18 +231,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (ApiTypeHelper.isDefined(this.runtime)) { - generator.writeKey("runtime"); - generator.writeStartObject(); - for (Map.Entry item0 : this.runtime.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - } // --------------------------------------------------------------------------------------------- @@ -464,33 +240,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private FieldNamesField fieldNames; - - @Nullable - private Map meta; - - @Nullable - private RoutingField routing; - - @Nullable - private SourceField source; - @Nullable private Boolean allowNoIndices; - @Nullable - private Boolean dateDetection; - - @Nullable - private DynamicMapping dynamic; - - @Nullable - private List dynamicDateFormats; - - @Nullable - private List> dynamicTemplates; - @Nullable private List expandWildcards; @@ -506,106 +258,15 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder

    properties; - @Nullable - private Map runtime; - @Nullable private Time timeout; @Nullable private Boolean writeIndexOnly; - /** - * Control whether field names are enabled for the index. - *

    - * API name: {@code _field_names} - */ - public final Builder fieldNames(@Nullable FieldNamesField value) { - this.fieldNames = value; - return this; - } - - /** - * Control whether field names are enabled for the index. - *

    - * API name: {@code _field_names} - */ - public final Builder fieldNames(Function> fn) { - return this.fieldNames(fn.apply(new FieldNamesField.Builder()).build()); - } - - /** - * A mapping type can have custom meta data associated with it. These are not - * used at all by Elasticsearch, but can be used to store application-specific - * metadata. - *

    - * API name: {@code _meta} - *

    - * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - return this; - } - - /** - * A mapping type can have custom meta data associated with it. These are not - * used at all by Elasticsearch, but can be used to store application-specific - * metadata. - *

    - * API name: {@code _meta} - *

    - * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; - } - - /** - * Enable making a routing value required on indexed documents. - *

    - * API name: {@code _routing} - */ - public final Builder routing(@Nullable RoutingField value) { - this.routing = value; - return this; - } - - /** - * Enable making a routing value required on indexed documents. - *

    - * API name: {@code _routing} - */ - public final Builder routing(Function> fn) { - return this.routing(fn.apply(new RoutingField.Builder()).build()); - } - - /** - * Control whether the _source field is enabled on the index. - *

    - * API name: {@code _source} - */ - public final Builder source(@Nullable SourceField value) { - this.source = value; - return this; - } - - /** - * Control whether the _source field is enabled on the index. - *

    - * API name: {@code _source} - */ - public final Builder source(Function> fn) { - return this.source(fn.apply(new SourceField.Builder()).build()); - } - /** * Whether to ignore if a wildcard indices expression resolves into no concrete * indices. (This includes _all string or when no indices have been @@ -618,79 +279,6 @@ public final Builder allowNoIndices(@Nullable Boolean value) { return this; } - /** - * Controls whether dynamic date detection is enabled. - *

    - * API name: {@code date_detection} - */ - public final Builder dateDetection(@Nullable Boolean value) { - this.dateDetection = value; - return this; - } - - /** - * Controls whether new fields are added dynamically. - *

    - * API name: {@code dynamic} - */ - public final Builder dynamic(@Nullable DynamicMapping value) { - this.dynamic = value; - return this; - } - - /** - * If date detection is enabled then new string fields are checked against - * 'dynamic_date_formats' and if the value matches then a new date field is - * added instead of string. - *

    - * API name: {@code dynamic_date_formats} - *

    - * Adds all elements of list to dynamicDateFormats. - */ - public final Builder dynamicDateFormats(List list) { - this.dynamicDateFormats = _listAddAll(this.dynamicDateFormats, list); - return this; - } - - /** - * If date detection is enabled then new string fields are checked against - * 'dynamic_date_formats' and if the value matches then a new date field is - * added instead of string. - *

    - * API name: {@code dynamic_date_formats} - *

    - * Adds one or more values to dynamicDateFormats. - */ - public final Builder dynamicDateFormats(String value, String... values) { - this.dynamicDateFormats = _listAdd(this.dynamicDateFormats, value, values); - return this; - } - - /** - * Specify dynamic templates for the mapping. - *

    - * API name: {@code dynamic_templates} - *

    - * Adds all elements of list to dynamicTemplates. - */ - public final Builder dynamicTemplates(List> list) { - this.dynamicTemplates = _listAddAll(this.dynamicTemplates, list); - return this; - } - - /** - * Specify dynamic templates for the mapping. - *

    - * API name: {@code dynamic_templates} - *

    - * Adds one or more values to dynamicTemplates. - */ - public final Builder dynamicTemplates(Map value, - Map... values) { - this.dynamicTemplates = _listAdd(this.dynamicTemplates, value, values); - return this; - } - /** * Whether to expand wildcard expression to concrete indices that are open, * closed or both. @@ -796,16 +384,6 @@ public final Builder clusterManagerTimeout(Function - * API name: {@code numeric_detection} - */ - public final Builder numericDetection(@Nullable Boolean value) { - this.numericDetection = value; - return this; - } - /** * Mapping for a field. For new fields, this mapping can include: *

      @@ -856,41 +434,6 @@ public final Builder properties(String key, Function - * API name: {@code runtime} - *

      - * Adds all entries of map to runtime. - */ - public final Builder runtime(Map map) { - this.runtime = _mapPutAll(this.runtime, map); - return this; - } - - /** - * Mapping of runtime fields for the index. - *

      - * API name: {@code runtime} - *

      - * Adds an entry to runtime. - */ - public final Builder runtime(String key, RuntimeField value) { - this.runtime = _mapPut(this.runtime, key, value); - return this; - } - - /** - * Mapping of runtime fields for the index. - *

      - * API name: {@code runtime} - *

      - * Adds an entry to runtime using a builder lambda. - */ - public final Builder runtime(String key, Function> fn) { - return runtime(key, fn.apply(new RuntimeField.Builder()).build()); - } - /** * Explicit operation timeout *

      @@ -943,21 +486,7 @@ public PutMappingRequest build() { .lazy(Builder::new, PutMappingRequest::setupPutMappingRequestDeserializer); protected static void setupPutMappingRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::fieldNames, FieldNamesField._DESERIALIZER, "_field_names"); - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::routing, RoutingField._DESERIALIZER, "_routing"); - op.add(Builder::source, SourceField._DESERIALIZER, "_source"); - op.add(Builder::dateDetection, JsonpDeserializer.booleanDeserializer(), "date_detection"); - op.add(Builder::dynamic, DynamicMapping._DESERIALIZER, "dynamic"); - op.add(Builder::dynamicDateFormats, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "dynamic_date_formats"); - op.add(Builder::dynamicTemplates, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.stringMapDeserializer(DynamicTemplate._DESERIALIZER)), "dynamic_templates"); - op.add(Builder::numericDetection, JsonpDeserializer.booleanDeserializer(), "numeric_detection"); op.add(Builder::properties, JsonpDeserializer.stringMapDeserializer(Property._DESERIALIZER), "properties"); - op.add(Builder::runtime, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), "runtime"); - } // ---------------------------------------------------------------------------------------------