Skip to content

Commit

Permalink
[codegen] Update to latest API specification
Browse files Browse the repository at this point in the history
  • Loading branch information
swallez committed Nov 9, 2022
1 parent 40fb890 commit 950d2af
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

package co.elastic.clients.elasticsearch._types.mapping;

import co.elastic.clients.json.JsonData;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
Expand Down Expand Up @@ -51,8 +50,6 @@
*/

public abstract class PropertyBase implements JsonpSerializable {
private final Map<String, JsonData> localMetadata;

private final Map<String, String> meta;

private final Map<String, Property> properties;
Expand All @@ -69,7 +66,6 @@ public abstract class PropertyBase implements JsonpSerializable {

protected PropertyBase(AbstractBuilder<?> builder) {

this.localMetadata = ApiTypeHelper.unmodifiable(builder.localMetadata);
this.meta = ApiTypeHelper.unmodifiable(builder.meta);
this.properties = ApiTypeHelper.unmodifiable(builder.properties);
this.ignoreAbove = builder.ignoreAbove;
Expand All @@ -78,13 +74,6 @@ protected PropertyBase(AbstractBuilder<?> builder) {

}

/**
* API name: {@code local_metadata}
*/
public final Map<String, JsonData> localMetadata() {
return this.localMetadata;
}

/**
* Metadata about the field.
* <p>
Expand Down Expand Up @@ -135,17 +124,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

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

}
generator.writeEnd();

}
if (ApiTypeHelper.isDefined(this.meta)) {
generator.writeKey("meta");
generator.writeStartObject();
Expand Down Expand Up @@ -199,9 +177,6 @@ public String toString() {
protected abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<BuilderT>>
extends
WithJsonObjectBuilderBase<BuilderT> {
@Nullable
private Map<String, JsonData> localMetadata;

@Nullable
private Map<String, String> meta;

Expand All @@ -217,26 +192,6 @@ protected abstract static class AbstractBuilder<BuilderT extends AbstractBuilder
@Nullable
private Map<String, Property> fields;

/**
* API name: {@code local_metadata}
* <p>
* Adds all entries of <code>map</code> to <code>localMetadata</code>.
*/
public final BuilderT localMetadata(Map<String, JsonData> map) {
this.localMetadata = _mapPutAll(this.localMetadata, map);
return self();
}

/**
* API name: {@code local_metadata}
* <p>
* Adds an entry to <code>localMetadata</code>.
*/
public final BuilderT localMetadata(String key, JsonData value) {
this.localMetadata = _mapPut(this.localMetadata, key, value);
return self();
}

/**
* Metadata about the field.
* <p>
Expand Down Expand Up @@ -343,8 +298,6 @@ public final BuilderT fields(String key, Function<Property.Builder, ObjectBuilde
protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupPropertyBaseDeserializer(
ObjectDeserializer<BuilderT> op) {

op.add(AbstractBuilder::localMetadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER),
"local_metadata");
op.add(AbstractBuilder::meta, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()),
"meta");
op.add(AbstractBuilder::properties, JsonpDeserializer.stringMapDeserializer(Property._DESERIALIZER),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import co.elastic.clients.elasticsearch._types.ErrorResponse;
import co.elastic.clients.elasticsearch._types.ExpandWildcard;
import co.elastic.clients.elasticsearch._types.HealthStatus;
import co.elastic.clients.elasticsearch._types.TimeUnit;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.ObjectBuilderDeserializer;
Expand Down Expand Up @@ -73,6 +74,9 @@ public class IndicesRequest extends CatRequestBase {
@Nullable
private final Boolean pri;

@Nullable
private final TimeUnit time;

// ---------------------------------------------------------------------------------------------

private IndicesRequest(Builder builder) {
Expand All @@ -83,6 +87,7 @@ private IndicesRequest(Builder builder) {
this.includeUnloadedSegments = builder.includeUnloadedSegments;
this.index = ApiTypeHelper.unmodifiable(builder.index);
this.pri = builder.pri;
this.time = builder.time;

}

Expand Down Expand Up @@ -151,6 +156,16 @@ public final Boolean pri() {
return this.pri;
}

/**
* The unit in which to display time values
* <p>
* API name: {@code time}
*/
@Nullable
public final TimeUnit time() {
return this.time;
}

// ---------------------------------------------------------------------------------------------

/**
Expand Down Expand Up @@ -178,6 +193,9 @@ public static class Builder extends CatRequestBase.AbstractBuilder<Builder>
@Nullable
private Boolean pri;

@Nullable
private TimeUnit time;

/**
* The unit in which to display byte values
* <p>
Expand Down Expand Up @@ -270,6 +288,16 @@ public final Builder pri(@Nullable Boolean value) {
return this;
}

/**
* The unit in which to display time values
* <p>
* API name: {@code time}
*/
public final Builder time(@Nullable TimeUnit value) {
this.time = value;
return this;
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -349,6 +377,9 @@ public IndicesRequest build() {
if (request.includeUnloadedSegments != null) {
params.put("include_unloaded_segments", String.valueOf(request.includeUnloadedSegments));
}
if (request.time != null) {
params.put("time", request.time.jsonValue());
}
return params;

}, SimpleEndpoint.emptyMap(), false, IndicesResponse._DESERIALIZER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private RankEvalRequest(Builder builder) {
this.allowNoIndices = builder.allowNoIndices;
this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards);
this.ignoreUnavailable = builder.ignoreUnavailable;
this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index");
this.index = ApiTypeHelper.unmodifiable(builder.index);
this.metric = builder.metric;
this.requests = ApiTypeHelper.unmodifiableRequired(builder.requests, this, "requests");
this.searchType = builder.searchType;
Expand Down Expand Up @@ -133,10 +133,10 @@ public final Boolean ignoreUnavailable() {
}

/**
* Required - Comma-separated list of data streams, indices, and index aliases
* used to limit the request. Wildcard (<code>*</code>) expressions are
* supported. To target all data streams and indices in a cluster, omit this
* parameter or use <code>_all</code> or <code>*</code>.
* Comma-separated list of data streams, indices, and index aliases used to
* limit the request. Wildcard (<code>*</code>) expressions are supported. To
* target all data streams and indices in a cluster, omit this parameter or use
* <code>_all</code> or <code>*</code>.
* <p>
* API name: {@code index}
*/
Expand Down Expand Up @@ -219,6 +219,7 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder> impleme
@Nullable
private Boolean ignoreUnavailable;

@Nullable
private List<String> index;

@Nullable
Expand Down Expand Up @@ -282,10 +283,10 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) {
}

/**
* Required - Comma-separated list of data streams, indices, and index aliases
* used to limit the request. Wildcard (<code>*</code>) expressions are
* supported. To target all data streams and indices in a cluster, omit this
* parameter or use <code>_all</code> or <code>*</code>.
* Comma-separated list of data streams, indices, and index aliases used to
* limit the request. Wildcard (<code>*</code>) expressions are supported. To
* target all data streams and indices in a cluster, omit this parameter or use
* <code>_all</code> or <code>*</code>.
* <p>
* API name: {@code index}
* <p>
Expand All @@ -297,10 +298,10 @@ public final Builder index(List<String> list) {
}

/**
* Required - Comma-separated list of data streams, indices, and index aliases
* used to limit the request. Wildcard (<code>*</code>) expressions are
* supported. To target all data streams and indices in a cluster, omit this
* parameter or use <code>_all</code> or <code>*</code>.
* Comma-separated list of data streams, indices, and index aliases used to
* limit the request. Wildcard (<code>*</code>) expressions are supported. To
* target all data streams and indices in a cluster, omit this parameter or use
* <code>_all</code> or <code>*</code>.
* <p>
* API name: {@code index}
* <p>
Expand Down Expand Up @@ -431,7 +432,8 @@ protected static void setupRankEvalRequestDeserializer(ObjectDeserializer<RankEv

int propsSet = 0;

propsSet |= _index;
if (ApiTypeHelper.isDefined(request.index()))
propsSet |= _index;

if (propsSet == 0) {
StringBuilder buf = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@
'_types.mapping.FieldAliasProperty': '_types/mapping/specialized.ts#L49-L52',
'_types.mapping.FieldMapping': '_types/mapping/meta-fields.ts#L24-L27',
'_types.mapping.FieldNamesField': '_types/mapping/meta-fields.ts#L42-L44',
'_types.mapping.FieldType': '_types/mapping/Property.ts#L159-L202',
'_types.mapping.FieldType': '_types/mapping/Property.ts#L158-L201',
'_types.mapping.FlattenedProperty': '_types/mapping/complex.ts#L26-L37',
'_types.mapping.FloatNumberProperty': '_types/mapping/core.ts#L131-L134',
'_types.mapping.FloatRangeProperty': '_types/mapping/range.ts#L38-L40',
Expand Down Expand Up @@ -724,8 +724,8 @@
'_types.mapping.OnScriptError': '_types/mapping/core.ts#L126-L129',
'_types.mapping.PercolatorProperty': '_types/mapping/core.ts#L177-L179',
'_types.mapping.PointProperty': '_types/mapping/geo.ts#L62-L67',
'_types.mapping.Property': '_types/mapping/Property.ts#L94-L157',
'_types.mapping.PropertyBase': '_types/mapping/Property.ts#L81-L92',
'_types.mapping.Property': '_types/mapping/Property.ts#L93-L156',
'_types.mapping.PropertyBase': '_types/mapping/Property.ts#L81-L91',
'_types.mapping.RangePropertyBase': '_types/mapping/range.ts#L23-L27',
'_types.mapping.RankFeatureProperty': '_types/mapping/core.ts#L181-L184',
'_types.mapping.RankFeaturesProperty': '_types/mapping/core.ts#L186-L188',
Expand Down Expand Up @@ -906,7 +906,7 @@
'cat.help.Request': 'cat/help/CatHelpRequest.ts#L22-L28',
'cat.help.Response': 'cat/help/CatHelpResponse.ts#L22-L24',
'cat.indices.IndicesRecord': 'cat/indices/types.ts#L20-L801',
'cat.indices.Request': 'cat/indices/CatIndicesRequest.ts#L23-L40',
'cat.indices.Request': 'cat/indices/CatIndicesRequest.ts#L24-L42',
'cat.indices.Response': 'cat/indices/CatIndicesResponse.ts#L22-L24',
'cat.master.MasterRecord': 'cat/master/types.ts#L20-L39',
'cat.master.Request': 'cat/master/CatMasterRequest.ts#L22-L28',
Expand Down Expand Up @@ -2522,10 +2522,10 @@
if (hash.length > 1) {
hash = hash.substring(1);
}
window.location = "https://github.com/elastic/elasticsearch-specification/tree/5d3e3a096596aeb750b2c33947ff54dcbc8ba6a4/specification/" + (paths[hash] || "");
window.location = "https://github.com/elastic/elasticsearch-specification/tree/555082f38110f65b60d470107d211fc354a5c55a/specification/" + (paths[hash] || "");
</script>
</head>
<body>
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/5d3e3a096596aeb750b2c33947ff54dcbc8ba6a4/specification/">Elasticsearch API specification</a>.
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/555082f38110f65b60d470107d211fc354a5c55a/specification/">Elasticsearch API specification</a>.
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ public final Time masterTimeout() {
}

/**
* Filters the returned indices to only indices that are managed by ILM.
* Filters the returned indices to only indices that are managed by ILM and are
* in an error state, either due to an encountering an error while executing the
* policy, or attempting to use a policy that does not exist.
* <p>
* API name: {@code only_errors}
*/
Expand All @@ -119,9 +121,7 @@ public final Boolean onlyErrors() {
}

/**
* Filters the returned indices to only indices that are managed by ILM and are
* in an error state, either due to an encountering an error while executing the
* policy, or attempting to use a policy that does not exist.
* Filters the returned indices to only indices that are managed by ILM.
* <p>
* API name: {@code only_managed}
*/
Expand Down Expand Up @@ -198,7 +198,9 @@ public final Builder masterTimeout(Function<Time.Builder, ObjectBuilder<Time>> f
}

/**
* Filters the returned indices to only indices that are managed by ILM.
* Filters the returned indices to only indices that are managed by ILM and are
* in an error state, either due to an encountering an error while executing the
* policy, or attempting to use a policy that does not exist.
* <p>
* API name: {@code only_errors}
*/
Expand All @@ -208,9 +210,7 @@ public final Builder onlyErrors(@Nullable Boolean value) {
}

/**
* Filters the returned indices to only indices that are managed by ILM and are
* in an error state, either due to an encountering an error while executing the
* policy, or attempting to use a policy that does not exist.
* Filters the returned indices to only indices that are managed by ILM.
* <p>
* API name: {@code only_managed}
*/
Expand Down
Loading

0 comments on commit 950d2af

Please sign in to comment.