-
Notifications
You must be signed in to change notification settings - Fork 24.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FieldTypeLookup to not implement Iterable #64983
FieldTypeLookup to not implement Iterable #64983
Conversation
FieldTypeLookup implements Iterable which is currently only used in IndexWarmer to iterate through all field types that have eager global ordinals set to true. Implementing Iterable makes it hard to track who iterates through all the field types. This commit exposes a new method that allows to provide a Predicate and returns an Iterable of all the field types that match the predicate.
Pinging @elastic/es-search (:Search/Mapping) |
public Iterable<MappedFieldType> fieldTypes() { | ||
return this.mapper == null ? Collections.emptySet() : this.mapper.mappers().fieldTypes(); | ||
public Iterable<MappedFieldType> fieldTypes(Predicate<MappedFieldType> predicate) { | ||
return this.mapper == null ? Collections.emptySet() : this.mapper.mappers().fieldTypes().filter(predicate); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we only use this for index warmers, maybe we should replace this with a getEagerGlobalOrdinalsFields()
method that returns a set of field names, and which calls FieldTypeLookup.filter() under the hood?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I agree. will do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
FieldTypeLookup implements Iterable which is currently only used in IndexWarmer to iterate through all field types that have eager global ordinals set to true. Implementing Iterable makes it hard to track who iterates through all the field types. This commit exposes a new method that allows to provide a Predicate and returns an Iterable of all the field types that match the predicate. Also, MapperService no longer exposes a way to iterate through all the field types, but rather only a specific method to iterate through the field types that have eager global ordinals.
FieldTypeLookup implements Iterable which is currently only used in IndexWarmer to iterate through all field types that have eager global ordinals set to true. Implementing Iterable makes it hard to track who iterates through all the field types. This commit exposes a new method that allows to provide a Predicate and returns an Iterable of all the field types that match the predicate. Also, MapperService no longer exposes a way to iterate through all the field types, but rather only a specific method to iterate through the field types that have eager global ordinals.
FieldTypeLookup implements Iterable which is currently only used in IndexWarmer to iterate through all field types that have eager global ordinals set to true. Implementing Iterable makes it hard to track who iterates through all the field types.
This commit exposes a new method that allows to provide a Predicate and returns an Iterable of all the field types that match the predicate.