Skip to content

Commit

Permalink
[Search Source] Do not request unmapped fields if source filters are …
Browse files Browse the repository at this point in the history
…provided (#91921) (#92014)
  • Loading branch information
Maja Grubic authored Feb 19, 2021
1 parent 3d689b9 commit 60c9fdc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,7 @@ describe('SearchSource', () => {
searchSource.setField('fields', [{ field: '*', include_unmapped: 'true' }]);

const request = await searchSource.getSearchRequestBody();
expect(request.fields).toEqual([
{ field: 'field1', include_unmapped: 'true' },
{ field: 'field2', include_unmapped: 'true' },
]);
expect(request.fields).toEqual([{ field: 'field1' }, { field: 'field2' }]);
});

test('returns all scripted fields when one fields entry is *', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,7 @@ export class SearchSource {
// we need to get the list of fields from an index pattern
return fields
.filter((fld: IndexPatternField) => filterSourceFields(fld.name))
.map((fld: IndexPatternField) => ({
field: fld.name,
...((wildcardField as Record<string, string>)?.include_unmapped && {
include_unmapped: (wildcardField as Record<string, string>).include_unmapped,
}),
}));
.map((fld: IndexPatternField) => ({ field: fld.name }));
}

private getFieldFromDocValueFieldsOrIndexPattern(
Expand Down

0 comments on commit 60c9fdc

Please sign in to comment.