@@ -70,6 +70,7 @@ public static class Defaults {
70
70
public static final Explicit <Boolean > COERCE = new Explicit <>(false , false );
71
71
public static final Explicit <Boolean > IGNORE_MALFORMED = new Explicit <>(false , false );
72
72
public static final Explicit <Boolean > IGNORE_Z_VALUE = new Explicit <>(true , false );
73
+ public static final Explicit <Boolean > DOC_VALUES = new Explicit <>(false , false );
73
74
}
74
75
75
76
@@ -122,15 +123,6 @@ public Builder(String name, MappedFieldType fieldType, MappedFieldType defaultFi
122
123
super (name , fieldType , defaultFieldType );
123
124
}
124
125
125
- public Builder (String name , MappedFieldType fieldType , MappedFieldType defaultFieldType ,
126
- boolean coerce , boolean ignoreMalformed , Orientation orientation , boolean ignoreZ ) {
127
- super (name , fieldType , defaultFieldType );
128
- this .coerce = coerce ;
129
- this .ignoreMalformed = ignoreMalformed ;
130
- this .orientation = orientation ;
131
- this .ignoreZValue = ignoreZ ;
132
- }
133
-
134
126
public Builder coerce (boolean coerce ) {
135
127
this .coerce = coerce ;
136
128
return this ;
@@ -190,6 +182,15 @@ public Builder ignoreZValue(final boolean ignoreZValue) {
190
182
return this ;
191
183
}
192
184
185
+ protected Explicit <Boolean > docValues () {
186
+ if (docValuesSet && fieldType .hasDocValues ()) {
187
+ return new Explicit <>(true , true );
188
+ } else if (docValuesSet ) {
189
+ return new Explicit <>(false , true );
190
+ }
191
+ return Defaults .DOC_VALUES ;
192
+ }
193
+
193
194
@ Override
194
195
protected void setupFieldType (BuilderContext context ) {
195
196
super .setupFieldType (context );
@@ -251,13 +252,20 @@ public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext
251
252
XContentMapValues .nodeBooleanValue (fieldNode ,
252
253
name + "." + GeoPointFieldMapper .Names .IGNORE_Z_VALUE .getPreferredName ()));
253
254
iterator .remove ();
255
+ } else if (TypeParsers .DOC_VALUES .equals (fieldName )) {
256
+ params .put (TypeParsers .DOC_VALUES , XContentMapValues .nodeBooleanValue (fieldNode , name + "." + TypeParsers .DOC_VALUES ));
257
+ iterator .remove ();
254
258
}
255
259
}
256
260
if (parserContext .indexVersionCreated ().onOrAfter (Version .V_6_6_0 ) && parsedDeprecatedParameters == false ) {
257
261
params .remove (DEPRECATED_PARAMETERS_KEY );
258
262
}
259
263
Builder builder = newBuilder (name , params );
260
264
265
+ if (params .containsKey (TypeParsers .DOC_VALUES )) {
266
+ builder .docValues ((Boolean ) params .get (TypeParsers .DOC_VALUES ));
267
+ }
268
+
261
269
if (params .containsKey (Names .COERCE .getPreferredName ())) {
262
270
builder .coerce ((Boolean )params .get (Names .COERCE .getPreferredName ()));
263
271
}
@@ -358,15 +366,17 @@ public QueryProcessor geometryQueryBuilder() {
358
366
protected Explicit <Boolean > coerce ;
359
367
protected Explicit <Boolean > ignoreMalformed ;
360
368
protected Explicit <Boolean > ignoreZValue ;
369
+ protected Explicit <Boolean > docValues ;
361
370
362
371
protected AbstractGeometryFieldMapper (String simpleName , MappedFieldType fieldType , MappedFieldType defaultFieldType ,
363
372
Explicit <Boolean > ignoreMalformed , Explicit <Boolean > coerce ,
364
- Explicit <Boolean > ignoreZValue , Settings indexSettings ,
373
+ Explicit <Boolean > ignoreZValue , Explicit < Boolean > docValues , Settings indexSettings ,
365
374
MultiFields multiFields , CopyTo copyTo ) {
366
375
super (simpleName , fieldType , defaultFieldType , indexSettings , multiFields , copyTo );
367
376
this .coerce = coerce ;
368
377
this .ignoreMalformed = ignoreMalformed ;
369
378
this .ignoreZValue = ignoreZValue ;
379
+ this .docValues = docValues ;
370
380
}
371
381
372
382
@ Override
@@ -382,6 +392,9 @@ protected void doMerge(Mapper mergeWith) {
382
392
if (gsfm .ignoreZValue .explicit ()) {
383
393
this .ignoreZValue = gsfm .ignoreZValue ;
384
394
}
395
+ if (gsfm .docValues .explicit ()) {
396
+ this .docValues = gsfm .docValues ;
397
+ }
385
398
}
386
399
387
400
@ Override
@@ -405,6 +418,9 @@ public void doXContentBody(XContentBuilder builder, boolean includeDefaults, Par
405
418
if (includeDefaults || ignoreZValue .explicit ()) {
406
419
builder .field (GeoPointFieldMapper .Names .IGNORE_Z_VALUE .getPreferredName (), ignoreZValue .value ());
407
420
}
421
+ if (includeDefaults || docValues .explicit ()) {
422
+ builder .field (TypeParsers .DOC_VALUES , docValues .value ());
423
+ }
408
424
}
409
425
410
426
public Explicit <Boolean > coerce () {
@@ -419,6 +435,10 @@ public Explicit<Boolean> ignoreZValue() {
419
435
return ignoreZValue ;
420
436
}
421
437
438
+ public Explicit <Boolean > docValues () {
439
+ return docValues ;
440
+ }
441
+
422
442
public Orientation orientation () {
423
443
return ((AbstractGeometryFieldType )fieldType ).orientation ();
424
444
}
0 commit comments