-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Refuse to load fields from _source when using the fields
option and support wildcards.
#15017
Conversation
* fields by names or by patterns. | ||
* Supported pattern styles "xxx*", "*xxx", "*xxx*" and "xxx*yyy". | ||
*/ | ||
public class WildcardFieldsVisitor extends CustomFieldsVisitor { |
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.
Should we fold the functionality directly into CustomFieldsVisitor?
Thanks Jim, I'm happily surprised that there were not too many tests using the |
@@ -87,7 +86,7 @@ | |||
body: | |||
fields: [ include.field2, _source ] | |||
query: { match_all: {} } | |||
- match: { hits.hits.0.fields: { include.field2 : [v2] }} | |||
- match: { hits.hits.0._source.include.field2: v2 } | |||
- is_true: hits.hits.0._source |
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.
The point of the two above tests seems to be to test bw compat, I think we can remove them?
Thanks @jimferenczi this looks good to me. I just left a comment about two REST tests that I think we should remove. @bleskes would you mind having a quick look at this PR before it gets merged? |
This looks good to me. Thanks @jimferenczi . My only question is whether we should resolve wild cards in the field visitor. Feels more natural for me to resolve it based on the mappings and get a concrete list to the visitor. I think we have the support we need in the MapperService (or will be easy to build). I'm worried that a wild card on the lucene level may expose system/hidden fields users didn't mean.. I don't think it's a problem in practice though. @jpountz wdyt? |
} | ||
} | ||
if (loadAllStored) { | ||
fieldsVisitor = new AllFieldsVisitor(); // load everything, including _source |
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.
is AllFieldsVisitor still used with your change? If not can you remove it?
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.
no it's not. I'll remove it.
@bleskes Good question. We already support fields=* in master (see mentions of |
@jimferenczi Let's merge this one? |
Do not to load fields from _source when using the `fields` option. Non stored (non existing) fields are ignored by the fields visitor when using the `fields` option. Fixes #10783 Support * wildcard to retrieve stored fields when using the `fields` option. Supported pattern styles are "xxx*", "*xxx", "*xxx*" and "xxx*yyy".
Refuse to load fields from _source when using the `fields` option and support wildcards.
@jimferenczi please add version labels for each branch that you merged this PR into |
Fixes #14489
Do not to load fields from _source when using the
fields
option.Non stored (non existing) fields are ignored by the fields visitor when using the
fields
option.Fixes #10783
Support * wildcard to retrieve stored fields when using the
fields
option.Supported pattern styles are "xxx_", "_xxx", "xxx" and "xxx*yyy".