Skip to content
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

Allow MappedFieldType impls to hide themselves from field caps #63547

Closed
wants to merge 2 commits into from

Conversation

romseygeek
Copy link
Contributor

Text fields can optionally index their content in multiple ways to speed up
phrase or prefix queries, implemented via named subfields with specialised
analysis chains. As these subfields need to be searchable, they have their
own FieldMappers and MappedFieldTypes; unfortunately, this means that
they can end up being returned in calls to the field_caps endpoint, where
really they are implementation details and should be hidden from users.

This commit adds a fieldCaps() method directly to MappedFieldType,
called by the field capabilities action. Field types that should be hidden
from field_caps can return null from this method, and will be excluded
from the response.

Fixes #63446

@romseygeek romseygeek added >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 v7.11.0 labels Oct 12, 2020
@romseygeek romseygeek self-assigned this Oct 12, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Oct 12, 2020
Copy link
Contributor

@jtibshirani jtibshirani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this doesn't address my general concern behind #63446. These fields will still be exposed through FieldTypeLookup, so any field pattern in a search will match them. For example fetching fields through "fields": ["*"] will match against these sub-fields as well, which is surprising behavior. It also feels off that we allow searching against them when they're not meant to be searched directly?

@romseygeek
Copy link
Contributor Author

OK, I think I understand the concerns better now. The issue here is that all FieldMappers expose a MappedFieldType to the lookup, and this is specifically used to build the general index-time analyzer. So ideally, we'd want to build these implementation fields without registering FieldMappers or MappedFieldTypes, but somehow still register their analyzers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v7.11.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text fields should not expose internal field types
4 participants