[serverless] add sorting to Discover CSV tests (#179901)

## Summary

Add sorting via api calls.
Update mappings file to load field data.
Update snapshots
This commit is contained in:
Tre 2024-04-03 17:50:07 +01:00 committed by GitHub
parent 0eba4ae42c
commit c1d310bbc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 10 deletions

View file

@ -6,7 +6,8 @@
"dynamic": false,
"properties": {
"text": {
"type": "text"
"type": "text",
"fielddata": "true"
}
}
}

View file

@ -79,21 +79,21 @@ xgMtOW0BH63Xcmy45GnD,ecommerce,\\"-\\",\\"Women's Clothing, Women's Shoes, Women
exports[`Reporting Generate CSV from SearchSource with unmapped fields includes all unmapped fields to the report 1`] = `
"\\"_id\\",\\"_index\\",\\"_score\\",\\"nested.unmapped\\",text,unmapped
1,recipes,1,\\"-\\",text1,unmapped1
2,recipes,1,unmapped2,text2,\\"-\\"
1,recipes,\\"-\\",\\"-\\",text1,unmapped1
2,recipes,\\"-\\",unmapped2,text2,\\"-\\"
"
`;
exports[`Reporting Generate CSV from SearchSource with unmapped fields includes an unmapped field to the report 1`] = `
"\\"_id\\",\\"_index\\",\\"_score\\",text,unmapped
1,recipes,1,text1,unmapped1
2,recipes,1,text2,\\"-\\"
1,recipes,\\"-\\",text1,unmapped1
2,recipes,\\"-\\",text2,\\"-\\"
"
`;
exports[`Reporting Generate CSV from SearchSource with unmapped fields includes an unmapped nested field to the report 1`] = `
"\\"_id\\",\\"_index\\",\\"_score\\",\\"nested.unmapped\\",text
1,recipes,1,\\"-\\",text1
2,recipes,1,unmapped2,text2
1,recipes,\\"-\\",\\"-\\",text1
2,recipes,\\"-\\",unmapped2,text2
"
`;

View file

@ -184,6 +184,7 @@ export default ({ getService }: FtrProviderContext) => {
query: { language: 'kuery', query: '' },
fields: fields.map((field) => ({ field, include_unmapped: 'true' })),
filter: [],
sort: [{ text: 'asc' as SortDirection }],
},
title: 'Untitled discover search',
version: '8.14.0',
@ -195,19 +196,19 @@ export default ({ getService }: FtrProviderContext) => {
it('includes an unmapped field to the report', async () => {
const csvFile = await generateCsvReportWithUnmapped(['text', 'unmapped']);
expect((csvFile as string).length).to.be(88);
expect((csvFile as string).length).to.be(92);
expectSnapshot(createPartialCsv(csvFile)).toMatch();
});
it('includes an unmapped nested field to the report', async () => {
const csvFile = await generateCsvReportWithUnmapped(['text', 'nested.unmapped']);
expect((csvFile as string).length).to.be(97);
expect((csvFile as string).length).to.be(101);
expectSnapshot(createPartialCsv(csvFile)).toMatch();
});
it('includes all unmapped fields to the report', async () => {
const csvFile = await generateCsvReportWithUnmapped(['*']);
expect((csvFile as string).length).to.be(120);
expect((csvFile as string).length).to.be(124);
expectSnapshot(createPartialCsv(csvFile)).toMatch();
});
});