-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Rename fields
to stored_fields
and add docvalue_fields
#18992
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
Conversation
SearchSourceBuilder.STORED_FIELDS_FIELD + "] to retrieve stored fields or _source filtering " + | ||
"if the field is not stored"); | ||
}, SearchSourceBuilder.FIELDS_FIELD, ObjectParser.ValueType.STRING_ARRAY); | ||
PARSER.declareStringArray(InnerHitBuilder::setDocValueFields, SearchSourceBuilder.DOCVALUE_FIELDS_FIELD); |
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 commit message says fielddata_fields is deprecated but you've removed it above. Maybe it should be a deprecated alias for docvalue_fields?
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.
It's already a deprecated alias for docvalue_fields, see SearchSourceBuilder.DOCVALUE_FIELDS_FIELD declaration.
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.
I see it now. Sorry!
I wonder if we're ok removing the methods that you've deprecated rather than just deprecating them? If you do keep them as deprecated can you add a note about when we expect to remove them? Notes like that are nice because they make it obvious to the caller and to us when we can remove them. |
if (sField != null) { | ||
if (!Strings.hasText(sField)) { | ||
searchSourceBuilder.noFields(); | ||
searchSourceBuilder.noStoredFields(); | ||
} else { | ||
String[] sFields = Strings.splitStringByCommaToArray(sField); | ||
if (sFields != null) { |
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.
I think you can drop the null check. It returns an empty array instead.
LGTM. I left only minor stuff. If you want I can make the documentation modifications that I proposed after you merge. |
`stored_fields` parameter will no longer try to retrieve fields from the _source but will only return stored fields. `fields` will throw an exception if the user uses it. Add `docvalue_fields` as an adjunct to `fielddata_fields` which is deprecated. `docvalue_fields` will try to load the value from the docvalue and fallback to fielddata cache if docvalues are not enabled on that field. Closes #18943
Thanks @nik9000 !
I think we should first remove the support for the fielddata cache. It should not be recommended and IMO it would be great if we can remove it completely. I'll open another issue to discuss ... |
Re-applied in afe99fc |
stored_fields
parameter will no longer try to retrieve fields from the _source but will only return stored fields.fields
will throw an exception if the user uses it.Add
docvalue_fields
as an adjunct tofielddata_fields
which is deprecated.docvalue_fields
will try to load the value from the docvalue and fallback to fielddata cache if docvalues are not enabled on that field.Closes #18943