support serializing nested searchsource#91525
Merged
ppisljar merged 5 commits intoelastic:masterfrom Feb 18, 2021
Merged
Conversation
Contributor
|
Pinging @elastic/kibana-app-services (Team:AppServices) |
16 tasks
streamich
approved these changes
Feb 17, 2021
Contributor
streamich
left a comment
There was a problem hiding this comment.
Code changes LGTM, also ran Kibana on Mac/Chrome all seems to be working.
Comment on lines
178
to
+181
| /** | ||
| * 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 { |
Contributor
There was a problem hiding this comment.
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 {
Contributor
Author
There was a problem hiding this comment.
yes, this is how the method looked in 7.11
Co-authored-by: Vadim Dalecky <streamich@gmail.com>
50709f4 to
c6481cf
Compare
Contributor
💚 Build SucceededMetrics [docs]Page load bundle
History
To update your PR or re-run it, just comment with: |
ppisljar
added a commit
to ppisljar/kibana
that referenced
this pull request
Feb 18, 2021
ppisljar
added a commit
that referenced
this pull request
Feb 19, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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