-
Notifications
You must be signed in to change notification settings - Fork 8.5k
support serializing nested searchsource #91525
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
|
Pinging @elastic/kibana-app-services (Team:AppServices) |
streamich
left a comment
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.
Code changes LGTM, also ran Kibana on Mac/Chrome all seems to be working.
| /** | ||
| * returns all search source fields | ||
| */ | ||
| getFields(recurse = false): SearchSourceFields { | ||
| let thisFilter = this.fields.filter; // type is single value, array, or function | ||
| if (thisFilter) { | ||
| if (typeof thisFilter === 'function') { | ||
| thisFilter = thisFilter() || []; // type is single value or array | ||
| } | ||
|
|
||
| if (Array.isArray(thisFilter)) { | ||
| thisFilter = [...thisFilter]; | ||
| } else { | ||
| thisFilter = [thisFilter]; | ||
| } | ||
| } else { | ||
| thisFilter = []; | ||
| } | ||
|
|
||
| if (recurse) { | ||
| const parent = this.getParent(); | ||
| if (parent) { | ||
| const parentFields = parent.getFields(recurse); | ||
|
|
||
| let parentFilter = parentFields.filter; // type is single value, array, or function | ||
| if (parentFilter) { | ||
| if (typeof parentFilter === 'function') { | ||
| parentFilter = parentFilter() || []; // type is single value or array | ||
| } | ||
|
|
||
| if (Array.isArray(parentFilter)) { | ||
| thisFilter.push(...parentFilter); | ||
| } else { | ||
| thisFilter.push(parentFilter); | ||
| } | ||
| } | ||
|
|
||
| // add combined filters to the fields | ||
| const thisFields = { | ||
| ...this.fields, | ||
| filter: thisFilter, | ||
| }; | ||
|
|
||
| return { ...parentFields, ...thisFields }; | ||
| } | ||
| } | ||
| getFields(): SearchSourceFields { |
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.
If I understand it correctly, this new getFields will not return the parent field, as it is now removed in constructor, I guess that is intentional?
/**
* Returns all search source fields, except `parent` field.
*/
getFields(): SearchSourceFields {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, this is how the method looked in 7.11
Co-authored-by: Vadim Dalecky <streamich@gmail.com>
50709f4 to
c6481cf
Compare
💚 Build SucceededMetrics [docs]Page load bundle
History
To update your PR or re-run it, just comment with: |
tsullivan
left a comment
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
Summary
Summarize your PR. If it involves visual changes include a screenshot or gif.
Checklist
Delete any items that are not applicable to this PR.
For maintainers