diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java index 1a78980d5b..17f3928655 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/mapping/IcuCollationKeywordProperty.java @@ -12,6 +12,10 @@ import java.util.function.Function; import javax.annotation.Nullable; import org.opensearch.client.json.*; +import org.opensearch.client.opensearch._types.analysis.IcuCollationAlternate; +import org.opensearch.client.opensearch._types.analysis.IcuCollationCaseFirst; +import org.opensearch.client.opensearch._types.analysis.IcuCollationDecomposition; +import org.opensearch.client.opensearch._types.analysis.IcuCollationStrength; import org.opensearch.client.util.ObjectBuilder; // typedef: _types.mapping.ICUCollationKeywordProperty @@ -25,13 +29,46 @@ public class IcuCollationKeywordProperty extends DocValuesPropertyBase implement @Nullable private final String nullValue; + // Collation Options + + @Nullable + private final IcuCollationAlternate alternate; + + @Nullable + private final Boolean caseLevel; + + @Nullable + private final IcuCollationCaseFirst caseFirst; + + @Nullable + private final IcuCollationDecomposition decomposition; + + @Nullable + private final Boolean hiraganaQuaternaryMode; + + @Nullable + private final Boolean numeric; + + @Nullable + private final IcuCollationStrength strength; + + @Nullable + private final String variableTop; + // --------------------------------------------------------------------------------------------- private IcuCollationKeywordProperty(Builder builder) { super(builder); - this.index = builder.index; this.nullValue = builder.nullValue; + this.alternate = builder.alternate; + this.caseLevel = builder.caseLevel; + this.caseFirst = builder.caseFirst; + this.decomposition = builder.decomposition; + this.hiraganaQuaternaryMode = builder.hiraganaQuaternaryMode; + this.numeric = builder.numeric; + this.strength = builder.strength; + this.variableTop = builder.variableTop; } public static IcuCollationKeywordProperty of(Function> fn) { @@ -59,6 +96,62 @@ public final String nullValue() { return this.nullValue; } + /** + * API name: {@code alternate} + */ + public final IcuCollationAlternate alternate() { + return this.alternate; + } + + /** + * API name: {@code case_level} + */ + public final Boolean caseLevel() { + return this.caseLevel; + } + + /** + * API name: {@code case_first} + */ + public final IcuCollationCaseFirst caseFirst() { + return this.caseFirst; + } + + /** + * API name: {@code decomposition} + */ + public final IcuCollationDecomposition decomposition() { + return this.decomposition; + } + + /** + * API name: {@code hiragana_quaternary_mode} + */ + public final Boolean hiraganaQuaternaryMode() { + return this.hiraganaQuaternaryMode; + } + + /** + * API name: {@code numeric} + */ + public final Boolean numeric() { + return this.numeric; + } + + /** + * API name: {@code strength} + */ + public final IcuCollationStrength strength() { + return this.strength; + } + + /** + * API name: {@code variable_top} + */ + public final String variableTop() { + return this.variableTop; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "icu_collation_keyword"); super.serializeInternal(generator, mapper); @@ -70,6 +163,38 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("null_value"); generator.write(this.nullValue); } + if (this.alternate != null) { + generator.writeKey("alternate"); + generator.write(this.alternate.jsonValue()); + } + if (this.caseLevel != null) { + generator.writeKey("case_level"); + generator.write(this.caseLevel); + } + if (this.caseFirst != null) { + generator.writeKey("case_first"); + generator.write(this.caseFirst.jsonValue()); + } + if (this.decomposition != null) { + generator.writeKey("decomposition"); + generator.write(this.decomposition.jsonValue()); + } + if (this.hiraganaQuaternaryMode != null) { + generator.writeKey("hiragana_quaternary_mode"); + generator.write(this.hiraganaQuaternaryMode); + } + if (this.numeric != null) { + generator.writeKey("numeric"); + generator.write(this.numeric); + } + if (this.strength != null) { + generator.writeKey("strength"); + generator.write(this.strength.jsonValue()); + } + if (this.variableTop != null) { + generator.writeKey("variable_top"); + generator.write(this.variableTop); + } } // --------------------------------------------------------------------------------------------- @@ -87,6 +212,30 @@ public static class Builder extends DocValuesPropertyBase.AbstractBuilder mappingTemplate = new HashMap<>(); + Map icuCollationConfig = new HashMap<>(); + icuCollationConfig.put("type", "icu_collation_keyword"); + icuCollationConfig.put("ignore_above", 1); + icuCollationConfig.put("index", true); + icuCollationConfig.put("null_value", "not-null-value"); + icuCollationConfig.put("store", true); + + // Collations + icuCollationConfig.put("alternate", "shifted"); + icuCollationConfig.put("case_level", true); + icuCollationConfig.put("case_first", "lower"); + icuCollationConfig.put("decomposition", "no"); + icuCollationConfig.put("hiragana_quaternary_mode", true); + icuCollationConfig.put("numeric", true); + icuCollationConfig.put("strength", "quaternary"); + icuCollationConfig.put("variable_top", "$"); + mappingTemplate.put( "test-index", Map.of( @@ -27,24 +44,7 @@ public void deserialize_IcuCollationKeywordExists_propertyDeserializes() throws "index_patterns", Collections.singletonList("test-pattern*"), "mappings", - Map.of( - "properties", - Map.of( - "icu_test_field", - Map.of( - "type", - "icu_collation_keyword", - "ignore_above", - 1, - "index", - true, - "null_value", - "not-null-value", - "store", - true - ) - ) - ), + Map.of("properties", Map.of("icu_test_field", icuCollationConfig)), "order", 0, "settings", @@ -70,5 +70,13 @@ public void deserialize_IcuCollationKeywordExists_propertyDeserializes() throws assertTrue(icu.index()); assertTrue(icu.store()); assertEquals((int) icu.ignoreAbove(), 1); + assertEquals(icu.alternate().jsonValue(), "shifted"); + assertTrue(icu.caseLevel()); + assertEquals(icu.caseFirst().jsonValue(), "lower"); + assertEquals(icu.decomposition().jsonValue(), "no"); + assertTrue(icu.hiraganaQuaternaryMode()); + assertTrue(icu.numeric()); + assertEquals(icu.strength().jsonValue(), "quaternary"); + assertEquals(icu.variableTop(), "$"); } }