Skip to content

Commit

Permalink
Improve performance for resolving derived fields (#16564)
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]>
(cherry picked from commit e07499a)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Nov 5, 2024
1 parent 2fa8370 commit 8d0c11f
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 8d0c11f

Please sign in to comment.