Skip to content

Commit

Permalink
Improve performance for resolving derived fields
Browse files Browse the repository at this point in the history
Doing the type check before the string comparison makes it much faster to resolve derived fields.

Signed-off-by: Robson Araujo <[email protected]>
  • Loading branch information
robson-glean authored Nov 5, 2024
1 parent 4c35a2b commit 83165ec
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Set<String> resolvePattern(String pattern) {
Set<String> derivedFields = new HashSet<>();
if (queryShardContext != null && queryShardContext.getMapperService() != null) {
for (MappedFieldType fieldType : queryShardContext.getMapperService().fieldTypes()) {
if (Regex.simpleMatch(pattern, fieldType.name()) && fieldType instanceof DerivedFieldType) {
if (fieldType instanceof DerivedFieldType && Regex.simpleMatch(pattern, fieldType.name())) {
derivedFields.add(fieldType.name());
}
}
Expand Down

0 comments on commit 83165ec

Please sign in to comment.