Skip to content

Commit

Permalink
[Search Source] Do not pick scripted fields if * provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Maja Grubic committed Dec 7, 2020
1 parent 446390d commit 305934e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/plugins/data/common/search/search_source/search_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,13 @@ export class SearchSource {
);
const uniqFieldNames = [...new Set([...bodyFieldNames, ...fieldsFromSource])];

// filter down script_fields to only include items specified
body.script_fields = pick(
body.script_fields,
Object.keys(body.script_fields).filter((f) => uniqFieldNames.includes(f))
);
if (uniqFieldNames.indexOf('*') === -1) {
// filter down script_fields to only include items specified
body.script_fields = pick(
body.script_fields,
Object.keys(body.script_fields).filter((f) => uniqFieldNames.includes(f))
);
}

// request the remaining fields from stored_fields just in case, since the
// fields API does not handle stored fields
Expand Down

0 comments on commit 305934e

Please sign in to comment.