From a7adfd6e701f12dfcca33389d90d39709995b975 Mon Sep 17 00:00:00 2001 From: Urs Keller Date: Wed, 10 Jan 2024 14:18:25 +0100 Subject: [PATCH] Add wrapper to builder --- .../opensearch/_types/query_dsl/Query.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java index 0890341a86..6167d02d3d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java @@ -1153,6 +1153,23 @@ public WildcardQuery wildcard() { return TaggedUnionUtils.get(this, Kind.Wildcard); } + /** + * Is this variant instance of kind {@code wrapper}? + */ + public boolean isWrapper() { + return this._kind == Query.Kind.Wrapper; + } + + /** + * Get the {@code wrapper} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code wrapper} kind. + */ + public WrapperQuery wrapper() { + return (WrapperQuery) TaggedUnionUtils.get(this, Query.Kind.Wrapper); + } + /** * Is this variant instance of kind {@code type}? */ @@ -1743,6 +1760,16 @@ public ObjectBuilder wildcard(Function wrapper(WrapperQuery v) { + this._kind = Query.Kind.Wrapper; + this._value = v; + return this; + } + + public ObjectBuilder wrapper(Function> fn) { + return this.wrapper(fn.apply(new WrapperQuery.Builder()).build()); + } + public ObjectBuilder type(TypeQuery v) { this._kind = Kind.Type; this._value = v;