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)
  • Loading branch information
Maja Grubic committed Feb 19, 2021
1 parent 038fd51 commit 52493e0
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 @@ -576,10 +576,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 @@ -537,12 +537,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 52493e0

Please sign in to comment.