29
29
import co .elastic .clients .util .ApiTypeHelper ;
30
30
import co .elastic .clients .util .ObjectBuilder ;
31
31
import jakarta .json .stream .JsonGenerator ;
32
+ import java .lang .Boolean ;
32
33
import java .lang .String ;
33
34
import java .util .Objects ;
34
35
import java .util .function .Function ;
@@ -72,6 +73,9 @@ public class GeoDistanceQuery extends QueryBase implements QueryVariant {
72
73
@ Nullable
73
74
private final GeoValidationMethod validationMethod ;
74
75
76
+ @ Nullable
77
+ private final Boolean ignoreUnmapped ;
78
+
75
79
// ---------------------------------------------------------------------------------------------
76
80
77
81
private GeoDistanceQuery (Builder builder ) {
@@ -82,6 +86,7 @@ private GeoDistanceQuery(Builder builder) {
82
86
this .distance = builder .distance ;
83
87
this .distanceType = builder .distanceType ;
84
88
this .validationMethod = builder .validationMethod ;
89
+ this .ignoreUnmapped = builder .ignoreUnmapped ;
85
90
86
91
}
87
92
@@ -135,6 +140,18 @@ public final GeoValidationMethod validationMethod() {
135
140
return this .validationMethod ;
136
141
}
137
142
143
+ /**
144
+ * Set to <code>true</code> to ignore an unmapped field and not match any
145
+ * documents for this query. Set to <code>false</code> to throw an exception if
146
+ * the field is not mapped.
147
+ * <p>
148
+ * API name: {@code ignore_unmapped}
149
+ */
150
+ @ Nullable
151
+ public final Boolean ignoreUnmapped () {
152
+ return this .ignoreUnmapped ;
153
+ }
154
+
138
155
protected void serializeInternal (JsonGenerator generator , JsonpMapper mapper ) {
139
156
generator .writeKey (this .field );
140
157
this .location .serialize (generator , mapper );
@@ -153,6 +170,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
153
170
generator .writeKey ("validation_method" );
154
171
this .validationMethod .serialize (generator , mapper );
155
172
}
173
+ if (this .ignoreUnmapped != null ) {
174
+ generator .writeKey ("ignore_unmapped" );
175
+ generator .write (this .ignoreUnmapped );
176
+
177
+ }
156
178
157
179
}
158
180
@@ -199,6 +221,9 @@ public final Builder location(Function<GeoLocation.Builder, ObjectBuilder<GeoLoc
199
221
@ Nullable
200
222
private GeoValidationMethod validationMethod ;
201
223
224
+ @ Nullable
225
+ private Boolean ignoreUnmapped ;
226
+
202
227
/**
203
228
* API name: {@code distance}
204
229
*/
@@ -223,6 +248,18 @@ public final Builder validationMethod(@Nullable GeoValidationMethod value) {
223
248
return this ;
224
249
}
225
250
251
+ /**
252
+ * Set to <code>true</code> to ignore an unmapped field and not match any
253
+ * documents for this query. Set to <code>false</code> to throw an exception if
254
+ * the field is not mapped.
255
+ * <p>
256
+ * API name: {@code ignore_unmapped}
257
+ */
258
+ public final Builder ignoreUnmapped (@ Nullable Boolean value ) {
259
+ this .ignoreUnmapped = value ;
260
+ return this ;
261
+ }
262
+
226
263
@ Override
227
264
protected Builder self () {
228
265
return this ;
@@ -254,6 +291,7 @@ protected static void setupGeoDistanceQueryDeserializer(ObjectDeserializer<GeoDi
254
291
op .add (Builder ::distance , JsonpDeserializer .stringDeserializer (), "distance" );
255
292
op .add (Builder ::distanceType , GeoDistanceType ._DESERIALIZER , "distance_type" );
256
293
op .add (Builder ::validationMethod , GeoValidationMethod ._DESERIALIZER , "validation_method" );
294
+ op .add (Builder ::ignoreUnmapped , JsonpDeserializer .booleanDeserializer (), "ignore_unmapped" );
257
295
258
296
op .setUnknownFieldHandler ((builder , name , parser , mapper ) -> {
259
297
builder .field (name );
0 commit comments