|
59 | 59 | */ |
60 | 60 |
|
61 | 61 | import { setWith } from '@elastic/safer-lodash-set'; |
62 | | -import { uniqueId, keyBy, pick, difference, omit, isFunction, isEqual } from 'lodash'; |
| 62 | +import { uniqueId, keyBy, pick, difference, isFunction, isEqual } from 'lodash'; |
63 | 63 | import { map, switchMap, tap } from 'rxjs/operators'; |
64 | 64 | import { defer, from } from 'rxjs'; |
65 | 65 | import { isObject } from 'rxjs/internal-compatibility'; |
@@ -114,12 +114,12 @@ export class SearchSource { |
114 | 114 | private readonly dependencies: SearchSourceDependencies; |
115 | 115 |
|
116 | 116 | constructor(fields: SearchSourceFields = {}, dependencies: SearchSourceDependencies) { |
117 | | - this.fields = fields; |
| 117 | + const { parent, ...currentFields } = fields; |
| 118 | + this.fields = currentFields; |
118 | 119 | this.dependencies = dependencies; |
119 | 120 |
|
120 | | - if (fields.parent) { |
121 | | - this.setParent(new SearchSource(fields.parent, dependencies)); |
122 | | - delete this.fields.parent; |
| 121 | + if (parent) { |
| 122 | + this.setParent(new SearchSource(parent, dependencies)); |
123 | 123 | } |
124 | 124 | } |
125 | 125 |
|
@@ -656,7 +656,7 @@ export class SearchSource { |
656 | 656 | * serializes search source fields (which can later be passed to {@link ISearchStartSearchSource}) |
657 | 657 | */ |
658 | 658 | public getSerializedFields(recurse = false) { |
659 | | - const { filter: originalFilters, ...searchSourceFields } = omit(this.getFields(), ['size']); |
| 659 | + const { filter: originalFilters, size: omit, ...searchSourceFields } = this.getFields(); |
660 | 660 | let serializedSearchSourceFields: SearchSourceFields = { |
661 | 661 | ...searchSourceFields, |
662 | 662 | index: (searchSourceFields.index ? searchSourceFields.index.id : undefined) as any, |
|
0 commit comments