The default _parent field should not try to load global ordinals (#25851)
The default _parent field tries to load global ordinals because it is created with eager_global_ordinals=true. This leads to an IllegalStateException because this field does not have doc_values. This change explicitely sets eager_global_ordinals to false in order to avoid the ISE on startup. Fixes #25849
This commit is contained in:
parent
0a4b38b60c
commit
93b04fb7bd
|
@ -65,7 +65,7 @@ public class ParentFieldMapper extends MetadataFieldMapper {
|
|||
FIELD_TYPE.setIndexOptions(IndexOptions.NONE);
|
||||
FIELD_TYPE.setHasDocValues(true);
|
||||
FIELD_TYPE.setDocValuesType(DocValuesType.SORTED);
|
||||
FIELD_TYPE.setEagerGlobalOrdinals(true);
|
||||
FIELD_TYPE.setEagerGlobalOrdinals(false);
|
||||
FIELD_TYPE.freeze();
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,8 @@ public class ParentFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public Builder(String documentType) {
|
||||
super(Defaults.NAME, new ParentFieldType(Defaults.FIELD_TYPE, documentType), Defaults.FIELD_TYPE);
|
||||
// Defaults to true
|
||||
eagerGlobalOrdinals(true);
|
||||
this.documentType = documentType;
|
||||
builder = this;
|
||||
}
|
||||
|
|
|
@ -124,6 +124,8 @@ public class ParentFieldMapperTests extends ESSingleNodeTestCase {
|
|||
Set<String> allFields = new HashSet<>(mapperService.simpleMatchToIndexNames("*"));
|
||||
assertTrue(allFields.contains("_parent"));
|
||||
assertFalse(allFields.contains("_parent#null"));
|
||||
MappedFieldType fieldType = mapperService.fullName("_parent");
|
||||
assertFalse(fieldType.eagerGlobalOrdinals());
|
||||
}
|
||||
|
||||
private static int getNumberOfFieldWithParentPrefix(ParseContext.Document doc) {
|
||||
|
|
Loading…
Reference in New Issue