Skip to content

Commit

Permalink
Improve performance for resolving derived fields (opensearch-project#…
Browse files Browse the repository at this point in the history
…16564)

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 b25e10a commit e07499a
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 e07499a

Please sign in to comment.