Skip to content

Commit 980a99a

Browse files
committed
plumb through the flag to fieldcaps
1 parent fb35040 commit 980a99a

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/EnrichPolicyResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ public void messageReceived(LookupRequest request, TransportChannel channel, Tas
448448
} else {
449449
failures.put(policyName, indexResult.toString());
450450
}
451-
}));
451+
}), false);
452452
}
453453
}
454454
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/EsqlSession.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ private void preAnalyzeLookupIndex(
468468
patternWithRemotes,
469469
fieldNames,
470470
null,
471-
listener.map(indexResolution -> receiveLookupIndexResolution(result, localPattern, executionInfo, indexResolution))
471+
listener.map(indexResolution -> receiveLookupIndexResolution(result, localPattern, executionInfo, indexResolution)),
472+
false
472473
);
473474
}
474475

@@ -686,7 +687,8 @@ private void preAnalyzeMainIndices(
686687
requestFilter,
687688
listener.delegateFailure((l, indexResolution) -> {
688689
l.onResponse(result.withIndexResolution(indexResolution));
689-
})
690+
}),
691+
false
690692
);
691693
}
692694
} else {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/session/IndexResolver.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,12 @@ public void resolveAsMergedMapping(
8181
String indexWildcard,
8282
Set<String> fieldNames,
8383
QueryBuilder requestFilter,
84-
ActionListener<IndexResolution> listener
84+
ActionListener<IndexResolution> listener,
85+
boolean includeAllDimensions
8586
) {
8687
client.execute(
8788
EsqlResolveFieldsAction.TYPE,
88-
createFieldCapsRequest(indexWildcard, fieldNames, requestFilter),
89+
createFieldCapsRequest(indexWildcard, fieldNames, requestFilter, includeAllDimensions),
8990
listener.delegateFailureAndWrap((l, response) -> l.onResponse(mergedMappings(indexWildcard, response)))
9091
);
9192
}
@@ -265,7 +266,12 @@ private static EsField conflictingMetricTypes(String name, String fullName, Fiel
265266
return new InvalidMappedField(name, "mapped as different metric types in indices: " + indices);
266267
}
267268

268-
private static FieldCapabilitiesRequest createFieldCapsRequest(String index, Set<String> fieldNames, QueryBuilder requestFilter) {
269+
private static FieldCapabilitiesRequest createFieldCapsRequest(
270+
String index,
271+
Set<String> fieldNames,
272+
QueryBuilder requestFilter,
273+
boolean includeAllDimensions
274+
) {
269275
FieldCapabilitiesRequest req = new FieldCapabilitiesRequest().indices(Strings.commaDelimitedListToStringArray(index));
270276
req.fields(fieldNames.toArray(String[]::new));
271277
req.includeUnmapped(true);
@@ -274,7 +280,11 @@ private static FieldCapabilitiesRequest createFieldCapsRequest(String index, Set
274280
// also because this way security doesn't throw authorization exceptions but rather honors ignore_unavailable
275281
req.indicesOptions(FIELD_CAPS_INDICES_OPTIONS);
276282
// we ignore the nested data type fields starting with https://github.com/elastic/elasticsearch/pull/111495
277-
req.filters("-nested");
283+
if (includeAllDimensions) {
284+
req.filters("-nested", "+dimensions");
285+
} else {
286+
req.filters("-nested");
287+
}
278288
req.setMergeResults(false);
279289
return req;
280290
}

0 commit comments

Comments
 (0)