Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unsupported fields from PutMappingRequest #597

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Fixed
- Fix version and build ([#254](https://github.com/opensearch-project/opensearch-java/pull/254))
- Fix PutMappingRequest by removing unsupported fields ([#597](https://github.com/opensearch-project/opensearch-java/pull/597))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ public class PutMappingRequest extends RequestBase implements JsonpSerializable

private final Map<String, Property> properties;

private final Map<String, RuntimeField> runtime;

@Nullable
private final Time timeout;

Expand All @@ -143,7 +141,6 @@ private PutMappingRequest(Builder builder) {
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;

Expand Down Expand Up @@ -323,15 +320,6 @@ public final Map<String, Property> properties() {
return this.properties;
}

/**
* Mapping of runtime fields for the index.
* <p>
* API name: {@code runtime}
*/
public final Map<String, RuntimeField> runtime() {
return this.runtime;
}

/**
* Explicit operation timeout
* <p>
Expand Down Expand Up @@ -443,18 +431,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeEnd();

}
if (ApiTypeHelper.isDefined(this.runtime)) {
generator.writeKey("runtime");
generator.writeStartObject();
for (Map.Entry<String, RuntimeField> item0 : this.runtime.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);

}
generator.writeEnd();

}

}

// ---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -512,9 +488,6 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<P
@Nullable
private Map<String, Property> properties;

@Nullable
private Map<String, RuntimeField> runtime;

@Nullable
private Time timeout;

Expand Down Expand Up @@ -856,41 +829,6 @@ public final Builder properties(String key, Function<Property.Builder, ObjectBui
return properties(key, fn.apply(new Property.Builder()).build());
}

/**
* Mapping of runtime fields for the index.
* <p>
* API name: {@code runtime}
* <p>
* Adds all entries of <code>map</code> to <code>runtime</code>.
*/
public final Builder runtime(Map<String, RuntimeField> map) {
this.runtime = _mapPutAll(this.runtime, map);
return this;
}

/**
* Mapping of runtime fields for the index.
* <p>
* API name: {@code runtime}
* <p>
* Adds an entry to <code>runtime</code>.
*/
public final Builder runtime(String key, RuntimeField value) {
this.runtime = _mapPut(this.runtime, key, value);
return this;
}

/**
* Mapping of runtime fields for the index.
* <p>
* API name: {@code runtime}
* <p>
* Adds an entry to <code>runtime</code> using a builder lambda.
*/
public final Builder runtime(String key, Function<RuntimeField.Builder, ObjectBuilder<RuntimeField>> fn) {
return runtime(key, fn.apply(new RuntimeField.Builder()).build());
}

/**
* Explicit operation timeout
* <p>
Expand Down Expand Up @@ -956,8 +894,6 @@ protected static void setupPutMappingRequestDeserializer(ObjectDeserializer<PutM
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");

}

// ---------------------------------------------------------------------------------------------
Expand Down
Loading