Skip to content

Commit

Permalink
Partial fixes from spec 2552 (#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta authored May 28, 2024
1 parent c9588aa commit 4961615
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ public String toString() {
return JsonpUtils.toString(this);
}

public static class Builder extends WithJsonObjectBuilderBase<Builder> {
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<Aggregation> {
private Kind _kind;
private Object _value;
private String _customKind;
Expand Down Expand Up @@ -2374,7 +2374,7 @@ public ContainerBuilder _custom(String name, Object data) {
return new ContainerBuilder();
}

protected Aggregation build() {
public Aggregation build() {
_checkSingleUse();
return new Aggregation(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public enum FieldType implements JsonEnum {

Object("object"),

Version("version"),

Murmur3("murmur3"),

TokenCount("token_count"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

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

import co.elastic.clients.elasticsearch._types.Script;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
Expand Down Expand Up @@ -70,6 +71,12 @@ public class KeywordProperty extends DocValuesPropertyBase implements PropertyVa
@Nullable
private final IndexOptions indexOptions;

@Nullable
private final Script script;

@Nullable
private final OnScriptError onScriptError;

@Nullable
private final String normalizer;

Expand All @@ -91,6 +98,8 @@ private KeywordProperty(Builder builder) {
this.eagerGlobalOrdinals = builder.eagerGlobalOrdinals;
this.index = builder.index;
this.indexOptions = builder.indexOptions;
this.script = builder.script;
this.onScriptError = builder.onScriptError;
this.normalizer = builder.normalizer;
this.norms = builder.norms;
this.nullValue = builder.nullValue;
Expand Down Expand Up @@ -142,6 +151,22 @@ public final IndexOptions indexOptions() {
return this.indexOptions;
}

/**
* API name: {@code script}
*/
@Nullable
public final Script script() {
return this.script;
}

/**
* API name: {@code on_script_error}
*/
@Nullable
public final OnScriptError onScriptError() {
return this.onScriptError;
}

/**
* API name: {@code normalizer}
*/
Expand Down Expand Up @@ -197,6 +222,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("index_options");
this.indexOptions.serialize(generator, mapper);
}
if (this.script != null) {
generator.writeKey("script");
this.script.serialize(generator, mapper);

}
if (this.onScriptError != null) {
generator.writeKey("on_script_error");
this.onScriptError.serialize(generator, mapper);
}
if (this.normalizer != null) {
generator.writeKey("normalizer");
generator.write(this.normalizer);
Expand Down Expand Up @@ -241,6 +275,12 @@ public static class Builder extends DocValuesPropertyBase.AbstractBuilder<Builde
@Nullable
private IndexOptions indexOptions;

@Nullable
private Script script;

@Nullable
private OnScriptError onScriptError;

@Nullable
private String normalizer;

Expand Down Expand Up @@ -285,6 +325,29 @@ public final Builder indexOptions(@Nullable IndexOptions value) {
return this;
}

/**
* API name: {@code script}
*/
public final Builder script(@Nullable Script value) {
this.script = value;
return this;
}

/**
* API name: {@code script}
*/
public final Builder script(Function<Script.Builder, ObjectBuilder<Script>> fn) {
return this.script(fn.apply(new Script.Builder()).build());
}

/**
* API name: {@code on_script_error}
*/
public final Builder onScriptError(@Nullable OnScriptError value) {
this.onScriptError = value;
return this;
}

/**
* API name: {@code normalizer}
*/
Expand Down Expand Up @@ -349,6 +412,8 @@ protected static void setupKeywordPropertyDeserializer(ObjectDeserializer<Keywor
op.add(Builder::eagerGlobalOrdinals, JsonpDeserializer.booleanDeserializer(), "eager_global_ordinals");
op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index");
op.add(Builder::indexOptions, IndexOptions._DESERIALIZER, "index_options");
op.add(Builder::script, Script._DESERIALIZER, "script");
op.add(Builder::onScriptError, OnScriptError._DESERIALIZER, "on_script_error");
op.add(Builder::normalizer, JsonpDeserializer.stringDeserializer(), "normalizer");
op.add(Builder::norms, JsonpDeserializer.booleanDeserializer(), "norms");
op.add(Builder::nullValue, JsonpDeserializer.stringDeserializer(), "null_value");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public String toString() {
return JsonpUtils.toString(this);
}

public static class Builder extends QueryBase.AbstractBuilder<Builder> {
public static class Builder extends QueryBase.AbstractBuilder<Builder> implements ObjectBuilder<PinnedQuery> {
private Kind _kind;
private Object _value;

Expand Down Expand Up @@ -254,7 +254,7 @@ public ContainerBuilder docs(List<PinnedDoc> v) {
return new ContainerBuilder();
}

protected PinnedQuery build() {
public PinnedQuery build() {
_checkSingleUse();
return new PinnedQuery(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public String toString() {
return JsonpUtils.toString(this);
}

public static class Builder extends WithJsonObjectBuilderBase<Builder> {
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<FieldSuggester> {
private Kind _kind;
private Object _value;
private String _customKind;
Expand Down Expand Up @@ -377,7 +377,7 @@ public ContainerBuilder _custom(String name, Object data) {
return new ContainerBuilder();
}

protected FieldSuggester build() {
public FieldSuggester build() {
_checkSingleUse();
return new FieldSuggester(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@
'_types.mapping.AllField': '_types/mapping/meta-fields.ts#L29-L40',
'_types.mapping.BinaryProperty': '_types/mapping/core.ts#L89-L91',
'_types.mapping.BooleanProperty': '_types/mapping/core.ts#L93-L99',
'_types.mapping.ByteNumberProperty': '_types/mapping/core.ts#L186-L189',
'_types.mapping.ByteNumberProperty': '_types/mapping/core.ts#L188-L191',
'_types.mapping.CompletionProperty': '_types/mapping/specialized.ts#L26-L34',
'_types.mapping.ConstantKeywordProperty': '_types/mapping/specialized.ts#L43-L46',
'_types.mapping.CorePropertyBase': '_types/mapping/core.ts#L52-L56',
Expand All @@ -674,67 +674,67 @@
'_types.mapping.DenseVectorIndexOptions': '_types/mapping/DenseVectorIndexOptions.ts#L22-L26',
'_types.mapping.DenseVectorProperty': '_types/mapping/complex.ts#L50-L57',
'_types.mapping.DocValuesPropertyBase': '_types/mapping/core.ts#L66-L68',
'_types.mapping.DoubleNumberProperty': '_types/mapping/core.ts#L166-L169',
'_types.mapping.DoubleNumberProperty': '_types/mapping/core.ts#L168-L171',
'_types.mapping.DoubleRangeProperty': '_types/mapping/range.ts#L42-L44',
'_types.mapping.DynamicMapping': '_types/mapping/dynamic-template.ts#L37-L46',
'_types.mapping.DynamicProperty': '_types/mapping/core.ts#L313-L343',
'_types.mapping.DynamicProperty': '_types/mapping/core.ts#L315-L345',
'_types.mapping.DynamicTemplate': '_types/mapping/dynamic-template.ts#L22-L30',
'_types.mapping.FieldAliasProperty': '_types/mapping/specialized.ts#L48-L51',
'_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#L73-L116',
'_types.mapping.FieldType': '_types/mapping/Property.ts#L73-L117',
'_types.mapping.FlattenedProperty': '_types/mapping/complex.ts#L25-L36',
'_types.mapping.FloatNumberProperty': '_types/mapping/core.ts#L156-L159',
'_types.mapping.FloatNumberProperty': '_types/mapping/core.ts#L158-L161',
'_types.mapping.FloatRangeProperty': '_types/mapping/range.ts#L46-L48',
'_types.mapping.GeoOrientation': '_types/mapping/geo.ts#L34-L39',
'_types.mapping.GeoPointProperty': '_types/mapping/geo.ts#L24-L32',
'_types.mapping.GeoShapeProperty': '_types/mapping/geo.ts#L41-L54',
'_types.mapping.GeoStrategy': '_types/mapping/geo.ts#L56-L59',
'_types.mapping.HalfFloatNumberProperty': '_types/mapping/core.ts#L161-L164',
'_types.mapping.HalfFloatNumberProperty': '_types/mapping/core.ts#L163-L166',
'_types.mapping.HistogramProperty': '_types/mapping/specialized.ts#L53-L56',
'_types.mapping.IndexField': '_types/mapping/meta-fields.ts#L46-L48',
'_types.mapping.IndexOptions': '_types/mapping/core.ts#L273-L278',
'_types.mapping.IntegerNumberProperty': '_types/mapping/core.ts#L171-L174',
'_types.mapping.IndexOptions': '_types/mapping/core.ts#L275-L280',
'_types.mapping.IntegerNumberProperty': '_types/mapping/core.ts#L173-L176',
'_types.mapping.IntegerRangeProperty': '_types/mapping/range.ts#L50-L52',
'_types.mapping.IpProperty': '_types/mapping/specialized.ts#L58-L64',
'_types.mapping.IpRangeProperty': '_types/mapping/range.ts#L54-L56',
'_types.mapping.JoinProperty': '_types/mapping/core.ts#L123-L126',
'_types.mapping.KeywordProperty': '_types/mapping/core.ts#L128-L138',
'_types.mapping.LongNumberProperty': '_types/mapping/core.ts#L176-L179',
'_types.mapping.KeywordProperty': '_types/mapping/core.ts#L128-L140',
'_types.mapping.LongNumberProperty': '_types/mapping/core.ts#L178-L181',
'_types.mapping.LongRangeProperty': '_types/mapping/range.ts#L58-L60',
'_types.mapping.MatchOnlyTextProperty': '_types/mapping/core.ts#L246-L271',
'_types.mapping.MatchOnlyTextProperty': '_types/mapping/core.ts#L248-L273',
'_types.mapping.MatchType': '_types/mapping/dynamic-template.ts#L32-L35',
'_types.mapping.Murmur3HashProperty': '_types/mapping/specialized.ts#L66-L68',
'_types.mapping.NestedProperty': '_types/mapping/complex.ts#L38-L43',
'_types.mapping.NumberPropertyBase': '_types/mapping/core.ts#L140-L143',
'_types.mapping.NumberPropertyBase': '_types/mapping/core.ts#L142-L145',
'_types.mapping.ObjectProperty': '_types/mapping/complex.ts#L45-L48',
'_types.mapping.OnScriptError': '_types/mapping/core.ts#L145-L148',
'_types.mapping.PercolatorProperty': '_types/mapping/core.ts#L214-L216',
'_types.mapping.OnScriptError': '_types/mapping/core.ts#L147-L150',
'_types.mapping.PercolatorProperty': '_types/mapping/core.ts#L216-L218',
'_types.mapping.PointProperty': '_types/mapping/geo.ts#L66-L71',
'_types.mapping.Property': '_types/mapping/Property.ts#L55-L71',
'_types.mapping.PropertyBase': '_types/mapping/Property.ts#L43-L53',
'_types.mapping.RangePropertyBase': '_types/mapping/range.ts#L23-L27',
'_types.mapping.RankFeatureProperty': '_types/mapping/core.ts#L218-L221',
'_types.mapping.RankFeaturesProperty': '_types/mapping/core.ts#L223-L226',
'_types.mapping.RankFeatureProperty': '_types/mapping/core.ts#L220-L223',
'_types.mapping.RankFeaturesProperty': '_types/mapping/core.ts#L225-L228',
'_types.mapping.RoutingField': '_types/mapping/meta-fields.ts#L50-L52',
'_types.mapping.RuntimeField': '_types/mapping/RuntimeFields.ts#L26-L30',
'_types.mapping.RuntimeFieldType': '_types/mapping/RuntimeFields.ts#L32-L40',
'_types.mapping.ScaledFloatNumberProperty': '_types/mapping/core.ts#L196-L201',
'_types.mapping.SearchAsYouTypeProperty': '_types/mapping/core.ts#L228-L238',
'_types.mapping.ScaledFloatNumberProperty': '_types/mapping/core.ts#L198-L203',
'_types.mapping.SearchAsYouTypeProperty': '_types/mapping/core.ts#L230-L240',
'_types.mapping.ShapeProperty': '_types/mapping/geo.ts#L73-L85',
'_types.mapping.ShortNumberProperty': '_types/mapping/core.ts#L181-L184',
'_types.mapping.ShortNumberProperty': '_types/mapping/core.ts#L183-L186',
'_types.mapping.SizeField': '_types/mapping/meta-fields.ts#L54-L56',
'_types.mapping.SourceField': '_types/mapping/meta-fields.ts#L58-L64',
'_types.mapping.StandardNumberProperty': '_types/mapping/core.ts#L150-L154',
'_types.mapping.StandardNumberProperty': '_types/mapping/core.ts#L152-L156',
'_types.mapping.SuggestContext': '_types/mapping/specialized.ts#L36-L41',
'_types.mapping.TermVectorOption': '_types/mapping/TermVectorOption.ts#L20-L28',
'_types.mapping.TextIndexPrefixes': '_types/mapping/core.ts#L280-L283',
'_types.mapping.TextProperty': '_types/mapping/core.ts#L285-L301',
'_types.mapping.TextIndexPrefixes': '_types/mapping/core.ts#L282-L285',
'_types.mapping.TextProperty': '_types/mapping/core.ts#L287-L303',
'_types.mapping.TokenCountProperty': '_types/mapping/specialized.ts#L70-L77',
'_types.mapping.TypeMapping': '_types/mapping/TypeMapping.ts#L34-L51',
'_types.mapping.UnsignedLongNumberProperty': '_types/mapping/core.ts#L191-L194',
'_types.mapping.VersionProperty': '_types/mapping/core.ts#L303-L305',
'_types.mapping.WildcardProperty': '_types/mapping/core.ts#L307-L311',
'_types.mapping.UnsignedLongNumberProperty': '_types/mapping/core.ts#L193-L196',
'_types.mapping.VersionProperty': '_types/mapping/core.ts#L305-L307',
'_types.mapping.WildcardProperty': '_types/mapping/core.ts#L309-L313',
'_types.query_dsl.BoolQuery': '_types/query_dsl/compound.ts#L28-L34',
'_types.query_dsl.BoostingQuery': '_types/query_dsl/compound.ts#L36-L40',
'_types.query_dsl.ChildScoreMode': '_types/query_dsl/joining.ts#L25-L39',
Expand Down Expand Up @@ -2351,10 +2351,10 @@
if (hash.length > 1) {
hash = hash.substring(1);
}
window.location = "https://github.com/elastic/elasticsearch-specification/tree/6991ecdf8b8ea1a434308721fb680058d2aef57d/specification/" + (paths[hash] || "");
window.location = "https://github.com/elastic/elasticsearch-specification/tree/3458c5d2594e7ad33da1b128469faa09881bbead/specification/" + (paths[hash] || "");
</script>
</head>
<body>
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/6991ecdf8b8ea1a434308721fb680058d2aef57d/specification/">Elasticsearch API specification</a>.
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/3458c5d2594e7ad33da1b128469faa09881bbead/specification/">Elasticsearch API specification</a>.
</body>
</html>

0 comments on commit 4961615

Please sign in to comment.