Skip to content

Commit f084daa

Browse files
authored
Simplify makeFieldConfig (#126021)
1 parent 52d6839 commit f084daa

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/stats/SearchContextStats.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,19 @@ private FieldConfig makeFieldConfig(String field) {
9595
// since if it's missing, deleted documents won't change that
9696
for (SearchExecutionContext context : contexts) {
9797
if (context.isFieldMapped(field)) {
98-
exists = exists || true;
99-
MappedFieldType type = context.getFieldType(field);
100-
indexed = indexed && type.isIndexed();
101-
hasDocValues = hasDocValues && type.hasDocValues();
102-
if (type instanceof TextFieldMapper.TextFieldType t) {
103-
hasExactSubfield = hasExactSubfield && t.canUseSyntheticSourceDelegateForQuerying();
104-
} else {
105-
hasExactSubfield = false;
106-
}
98+
var type = context.getFieldType(field);
99+
exists |= true;
100+
indexed &= type.isIndexed();
101+
hasDocValues &= type.hasDocValues();
102+
hasExactSubfield &= type instanceof TextFieldMapper.TextFieldType t && t.canUseSyntheticSourceDelegateForQuerying();
107103
} else {
108104
indexed = false;
109105
hasDocValues = false;
110106
hasExactSubfield = false;
111107
}
108+
if (exists && indexed == false && hasDocValues == false && hasExactSubfield == false) {
109+
break;
110+
}
112111
}
113112
if (exists == false) {
114113
// if it does not exist on any context, no other settings are valid

0 commit comments

Comments
 (0)