1
0
Эх сурвалжийг харах

Merge null_value for boolean field and remove include_in_all for boolean field in doc

Close #5502
Kevin 11 жил өмнө
parent
commit
1496b03458

+ 0 - 4
docs/reference/mapping/types/core-types.asciidoc

@@ -389,10 +389,6 @@ in `_source`, have `include_in_all` enabled, or `store` be set to
 |`null_value` |When there is a (JSON) null value for the field, use the
 `null_value` as the field value. Defaults to not adding the field at
 all.
-
-|`include_in_all` |Should the field be included in the `_all` field (if
-enabled). If `index` is set to `no` this defaults to `false`, otherwise,
-defaults to `true` or to the parent `object` type setting.
 |=======================================================================
 
 [float]

+ 13 - 3
src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java

@@ -36,9 +36,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
 import org.elasticsearch.index.codec.docvaluesformat.DocValuesFormatProvider;
 import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
 import org.elasticsearch.index.fielddata.FieldDataType;
-import org.elasticsearch.index.mapper.Mapper;
-import org.elasticsearch.index.mapper.MapperParsingException;
-import org.elasticsearch.index.mapper.ParseContext;
+import org.elasticsearch.index.mapper.*;
 import org.elasticsearch.index.similarity.SimilarityProvider;
 
 import java.io.IOException;
@@ -226,6 +224,18 @@ public class BooleanFieldMapper extends AbstractFieldMapper<Boolean> {
         fields.add(new Field(names.indexName(), value ? "T" : "F", fieldType));
     }
 
+    @Override
+    public void merge(Mapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
+        super.merge(mergeWith, mergeContext);
+        if (!this.getClass().equals(mergeWith.getClass())) {
+            return;
+        }
+
+        if (!mergeContext.mergeFlags().simulate()) {
+            this.nullValue = ((BooleanFieldMapper) mergeWith).nullValue;
+        }
+    }
+
     @Override
     protected String contentType() {
         return CONTENT_TYPE;