Skip to content

Commit

Permalink
Generate basic index template operations (#1293)
Browse files Browse the repository at this point in the history
* Generate basic index template operations

Generate indices.get_index_template

Signed-off-by: Thomas Farr <[email protected]>

Generate indices.put_index_template

Signed-off-by: Thomas Farr <[email protected]>

Generate indices.exists_index_template

Signed-off-by: Thomas Farr <[email protected]>

Generate indices.delete_index_template

Signed-off-by: Thomas Farr <[email protected]>

Generate indices.simulate_index_template

Signed-off-by: Thomas Farr <[email protected]>

* Allow deserializing path params from JSON

Signed-off-by: Thomas Farr <[email protected]>

* Fix compile

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Nov 14, 2024
1 parent 5dbe61e commit c7103d8
Show file tree
Hide file tree
Showing 37 changed files with 2,127 additions and 1,304 deletions.
15 changes: 14 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,17 @@ After:
- `PointProperty` has been removed and is replaced by `XyPointProperty`.

### PropertyBase
- The `name` and `localMetadata` fields, getters and builder methods have been removed from `PropertyBase` as they are not supported by OpenSearch.
- The `name` and `localMetadata` fields, getters and builder methods have been removed from `PropertyBase` as they are not supported by OpenSearch.

### IndexTemplate
- `IndexTemplate` has been moved from the `org.opensearch.client.opensearch.indices.get_index_template` package to the `org.opensearch.client.opensearch.indices` package.
- The `dataStream` property is now of type `IndexTemplateDataStreamConfiguration` instead of `Map<String, JsonData>`.

### IndexTemplateSummary
- `IndexTemplateSummary` has been moved from the `org.opensearch.client.opensearch.indices.get_index_template` package to the `org.opensearch.client.opensearch.indices` package.
- The `settings` property is now of type `IndexSettings` instead of `Map<String, JsonData>`.

### DataStream renamed to IndexTemplateDataStreamConfiguration
- The `DataStream` class has been renamed to `IndexTemplateDataStreamConfiguration`, this affects:
- `PutIndexTemplateRequest`'s `dataStream` field.
- `SimulateIndexTemplateRequest`'s `dataStream` field.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public class IcuCollationKeywordProperty extends DocValuesPropertyBase implement
@Nullable
private final Boolean caseLevel;

@Nullable
private final String country;

@Nullable
private final IcuCollationDecomposition decomposition;

Expand All @@ -76,6 +79,9 @@ public class IcuCollationKeywordProperty extends DocValuesPropertyBase implement
@Nullable
private final Boolean index;

@Nullable
private final String language;

@Nullable
private final String nullValue;

Expand All @@ -88,20 +94,26 @@ public class IcuCollationKeywordProperty extends DocValuesPropertyBase implement
@Nullable
private final String variableTop;

@Nullable
private final String variant;

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

private IcuCollationKeywordProperty(Builder builder) {
super(builder);
this.alternate = builder.alternate;
this.caseFirst = builder.caseFirst;
this.caseLevel = builder.caseLevel;
this.country = builder.country;
this.decomposition = builder.decomposition;
this.hiraganaQuaternaryMode = builder.hiraganaQuaternaryMode;
this.index = builder.index;
this.language = builder.language;
this.nullValue = builder.nullValue;
this.numeric = builder.numeric;
this.strength = builder.strength;
this.variableTop = builder.variableTop;
this.variant = builder.variant;
}

public static IcuCollationKeywordProperty of(
Expand Down Expand Up @@ -142,6 +154,14 @@ public final Boolean caseLevel() {
return this.caseLevel;
}

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

/**
* API name: {@code decomposition}
*/
Expand All @@ -166,6 +186,14 @@ public final Boolean index() {
return this.index;
}

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

/**
* API name: {@code null_value}
*/
Expand Down Expand Up @@ -198,6 +226,14 @@ public final String variableTop() {
return this.variableTop;
}

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

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write("type", "icu_collation_keyword");
super.serializeInternal(generator, mapper);
Expand All @@ -216,6 +252,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.caseLevel);
}

if (this.country != null) {
generator.writeKey("country");
generator.write(this.country);
}

if (this.decomposition != null) {
generator.writeKey("decomposition");
this.decomposition.serialize(generator, mapper);
Expand All @@ -231,6 +272,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.index);
}

if (this.language != null) {
generator.writeKey("language");
generator.write(this.language);
}

if (this.nullValue != null) {
generator.writeKey("null_value");
generator.write(this.nullValue);
Expand All @@ -250,6 +296,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("variable_top");
generator.write(this.variableTop);
}

if (this.variant != null) {
generator.writeKey("variant");
generator.write(this.variant);
}
}

// ---------------------------------------------------------------------------------------------
Expand All @@ -267,19 +318,25 @@ public static class Builder extends DocValuesPropertyBase.AbstractBuilder<Builde
@Nullable
private Boolean caseLevel;
@Nullable
private String country;
@Nullable
private IcuCollationDecomposition decomposition;
@Nullable
private Boolean hiraganaQuaternaryMode;
@Nullable
private Boolean index;
@Nullable
private String language;
@Nullable
private String nullValue;
@Nullable
private Boolean numeric;
@Nullable
private IcuCollationStrength strength;
@Nullable
private String variableTop;
@Nullable
private String variant;

/**
* API name: {@code alternate}
Expand All @@ -305,6 +362,14 @@ public final Builder caseLevel(@Nullable Boolean value) {
return this;
}

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

/**
* API name: {@code decomposition}
*/
Expand All @@ -329,6 +394,14 @@ public final Builder index(@Nullable Boolean value) {
return this;
}

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

/**
* API name: {@code null_value}
*/
Expand Down Expand Up @@ -361,6 +434,14 @@ public final Builder variableTop(@Nullable String value) {
return this;
}

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

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -393,13 +474,16 @@ protected static void setupIcuCollationKeywordPropertyDeserializer(ObjectDeseria
op.add(Builder::alternate, IcuCollationAlternate._DESERIALIZER, "alternate");
op.add(Builder::caseFirst, IcuCollationCaseFirst._DESERIALIZER, "case_first");
op.add(Builder::caseLevel, JsonpDeserializer.booleanDeserializer(), "case_level");
op.add(Builder::country, JsonpDeserializer.stringDeserializer(), "country");
op.add(Builder::decomposition, IcuCollationDecomposition._DESERIALIZER, "decomposition");
op.add(Builder::hiraganaQuaternaryMode, JsonpDeserializer.booleanDeserializer(), "hiragana_quaternary_mode");
op.add(Builder::index, JsonpDeserializer.booleanDeserializer(), "index");
op.add(Builder::language, JsonpDeserializer.stringDeserializer(), "language");
op.add(Builder::nullValue, JsonpDeserializer.stringDeserializer(), "null_value");
op.add(Builder::numeric, JsonpDeserializer.booleanDeserializer(), "numeric");
op.add(Builder::strength, IcuCollationStrength._DESERIALIZER, "strength");
op.add(Builder::variableTop, JsonpDeserializer.stringDeserializer(), "variable_top");
op.add(Builder::variant, JsonpDeserializer.stringDeserializer(), "variant");

op.ignore("type");
}
Expand All @@ -410,13 +494,16 @@ public int hashCode() {
result = 31 * result + Objects.hashCode(this.alternate);
result = 31 * result + Objects.hashCode(this.caseFirst);
result = 31 * result + Objects.hashCode(this.caseLevel);
result = 31 * result + Objects.hashCode(this.country);
result = 31 * result + Objects.hashCode(this.decomposition);
result = 31 * result + Objects.hashCode(this.hiraganaQuaternaryMode);
result = 31 * result + Objects.hashCode(this.index);
result = 31 * result + Objects.hashCode(this.language);
result = 31 * result + Objects.hashCode(this.nullValue);
result = 31 * result + Objects.hashCode(this.numeric);
result = 31 * result + Objects.hashCode(this.strength);
result = 31 * result + Objects.hashCode(this.variableTop);
result = 31 * result + Objects.hashCode(this.variant);
return result;
}

Expand All @@ -431,12 +518,15 @@ public boolean equals(Object o) {
return Objects.equals(this.alternate, other.alternate)
&& Objects.equals(this.caseFirst, other.caseFirst)
&& Objects.equals(this.caseLevel, other.caseLevel)
&& Objects.equals(this.country, other.country)
&& Objects.equals(this.decomposition, other.decomposition)
&& Objects.equals(this.hiraganaQuaternaryMode, other.hiraganaQuaternaryMode)
&& Objects.equals(this.index, other.index)
&& Objects.equals(this.language, other.language)
&& Objects.equals(this.nullValue, other.nullValue)
&& Objects.equals(this.numeric, other.numeric)
&& Objects.equals(this.strength, other.strength)
&& Objects.equals(this.variableTop, other.variableTop);
&& Objects.equals(this.variableTop, other.variableTop)
&& Objects.equals(this.variant, other.variant);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ public CreateIndexRequest build() {

protected static void setupCreateIndexRequestDeserializer(ObjectDeserializer<CreateIndexRequest.Builder> op) {
op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases");
op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index");
op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings");
op.add(Builder::settings, IndexSettings._DESERIALIZER, "settings");
}
Expand Down
Loading

0 comments on commit c7103d8

Please sign in to comment.