Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const createSuccessSearchResponse = (objects: ObjectInfo[]): estypes.SearchRespo
_shards: {} as any,
hits: {
total: objects.length,
max_score: 1,
hits: objects.map(createHit),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ describe('SavedObjectsRepository Encryption Extension', () => {
_shards: {} as any,
hits: {
total: 2,
max_score: 2,
hits: [
{
_index: MAIN_SAVED_OBJECT_INDEX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ export const generateIndexPatternSearchResults = (namespace?: string) => {
_shards: {} as any,
hits: {
total: 4,
max_score: 4,
hits: [
{
_index: MAIN_SAVED_OBJECT_INDEX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ describe('CsvGenerator', () => {
_id: 'my-cool-id',
_index: 'my-cool-index',
_version: 4,
_score: 1,
fields: {
sku: [`This is a cool SKU.`, `This is also a cool SKU.`],
},
Expand Down Expand Up @@ -1054,6 +1055,7 @@ describe('CsvGenerator', () => {
_id: 'my-cool-id',
_index: 'my-cool-index',
_version: 4,
_score: 1,
fields: {
date: ['2020-12-31T00:14:28.000Z'],
message: [`it's nice to see you`],
Expand Down Expand Up @@ -1104,6 +1106,7 @@ describe('CsvGenerator', () => {
_id: 'my-cool-id',
_index: 'my-cool-index',
_version: 4,
_score: 1,
fields: {
date: ['2020-12-31T00:14:28.000Z'],
message_z: [`test field Z`],
Expand Down Expand Up @@ -1161,6 +1164,7 @@ describe('CsvGenerator', () => {
_id: 'my-cool-id',
_index: 'my-cool-index',
_version: 4,
_score: 1,
fields: {
product: 'coconut',
category: [`cool`, `rad`],
Expand Down Expand Up @@ -1200,6 +1204,7 @@ describe('CsvGenerator', () => {
_id: 'my-cool-id',
_index: 'my-cool-index',
_version: 4,
_score: 1,
fields: {
product: 'coconut',
category: [`cool`, `rad`],
Expand Down Expand Up @@ -1239,6 +1244,7 @@ describe('CsvGenerator', () => {
_id: 'my-cool-id',
_index: 'my-cool-index',
_version: 4,
_score: 1,
fields: {
product: 'coconut',
category: [`cool`, `rad`],
Expand Down Expand Up @@ -1570,6 +1576,7 @@ describe('CsvGenerator', () => {
range(0, 5).map(() => ({
_index: 'lasdf',
_id: 'lasdf123',
_score: 1,
fields: {
date: ['2020-12-31T00:14:28.000Z'],
ip: ['110.135.176.89'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ describe('CSV Export Search Cursor', () => {
});

it('can update internal cursor ID', () => {
cursor.updateIdFromResults({ pit_id: 'very-typical-pit-id', hits: { hits: [] } });
cursor.updateIdFromResults({
pit_id: 'very-typical-pit-id',
hits: { max_score: null, hits: [] },
});
expect(cursor.getCursorId()).toBe('very-typical-pit-id');
});

Expand All @@ -123,6 +126,7 @@ describe('CSV Export Search Cursor', () => {
{
_index: 'test-index',
_id: 'test-doc-id',
_score: 1,
sort: ['Wed Jan 17 15:35:47 MST 2024', 42],
},
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { buildDataTableRecord } from './build_data_record';
describe('calcFieldCounts', () => {
test('returns valid field count data', async () => {
const rows = [
{ _id: '1', _index: 'test', _source: { message: 'test1', bytes: 20 } },
{ _id: '2', _index: 'test', _source: { name: 'test2', extension: 'jpg' } },
{ _id: '1', _index: 'test', _score: 1, _source: { message: 'test1', bytes: 20 } },
{ _id: '2', _index: 'test', _score: 1, _source: { name: 'test2', extension: 'jpg' } },
].map((row) => buildDataTableRecord(row));
const result = calcFieldCounts(rows);
expect(result).toMatchInlineSnapshot(`
Expand All @@ -28,8 +28,8 @@ describe('calcFieldCounts', () => {
});
test('updates field count data', async () => {
const rows = [
{ _id: '1', _index: 'test', _source: { message: 'test1', bytes: 20 } },
{ _id: '2', _index: 'test', _source: { name: 'test2', extension: 'jpg' } },
{ _id: '1', _index: 'test', _score: 1, _source: { message: 'test1', bytes: 20 } },
{ _id: '2', _index: 'test', _score: 1, _source: { name: 'test2', extension: 'jpg' } },
].map((row) => buildDataTableRecord(row));
const result = calcFieldCounts(rows);
expect(result).toMatchInlineSnapshot(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('convertValueToString', () => {
flattenedValue: 'test',
dataTableRecord: {
id: '1',
raw: {},
raw: { _score: 1 },
flattened: { testKey: 'testValue' },
},
fieldFormats: fieldFormatsMock,
Expand All @@ -83,7 +83,7 @@ describe('convertValueToString', () => {
flattenedValue: ['value1', 'value2'],
dataTableRecord: {
id: '1',
raw: {},
raw: { _score: 1 },
flattened: { testKey: 'testValue' },
},
fieldFormats: fieldFormatsMock,
Expand All @@ -107,7 +107,7 @@ describe('convertValueToString', () => {
flattenedValue: 'value',
dataTableRecord: {
id: '1',
raw: {},
raw: { _score: 1 },
flattened: { testKey: 'testValue' },
},
fieldFormats: fieldFormatsMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('formatHit', () => {
hit = {
_id: '1',
_index: 'logs',
_score: 1,
fields: {
message: ['foobar'],
extension: ['png'],
Expand Down Expand Up @@ -111,6 +112,7 @@ describe('formatHit', () => {
{
_id: '2',
_index: 'logs',
_score: 1,
fields: {
object: ['object'],
'object.value': [42, 13],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const services = {
const hit = {
_id: '1',
_index: 'index',
_score: 1,
fields: {
message: 'foo',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getFieldValue } from './get_field_value';

const dataTableRecord: DataTableRecord = {
id: '1',
raw: {},
raw: { _score: 1 },
flattened: {
'field1.value': 'value1',
'field2.value': ['value2'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('getFormattedFields', () => {
field3: null,
field4: undefined,
},
raw: {},
raw: { _score: 1 },
};

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('extract search response warnings', () => {
took: 999,
timed_out: true,
_shards: {} as estypes.ShardStatistics,
hits: { hits: [] },
hits: { max_score: null, hits: [] },
};
expect(
extractWarnings(response, mockInspectorService, mockRequestAdapter, 'My request')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('handleWarnings', () => {
took: 999,
timed_out: true,
_shards: {} as estypes.ShardStatistics,
hits: { hits: [] },
hits: { max_score: null, hits: [] },
} as estypes.SearchResponse,
services: {
inspector: {} as unknown as InspectorStart,
Expand All @@ -75,7 +75,7 @@ describe('handleWarnings', () => {
took: 999,
timed_out: true,
_shards: {} as estypes.ShardStatistics,
hits: { hits: [] },
hits: { max_score: null, hits: [] },
} as estypes.SearchResponse,
services: {
inspector: {} as unknown as InspectorStart,
Expand All @@ -99,7 +99,7 @@ describe('handleWarnings', () => {
took: 999,
timed_out: true,
_shards: {} as estypes.ShardStatistics,
hits: { hits: [] },
hits: { max_score: null, hits: [] },
} as estypes.SearchResponse,
services: {
inspector: {} as unknown as InspectorStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ describe('UnifiedDataTable', () => {
id: 'test',
raw: {
_index: 'test_i',
_score: 1,
_id: 'test',
},
flattened: { test: jest.fn() },
Expand Down Expand Up @@ -816,6 +817,7 @@ describe('UnifiedDataTable', () => {
id: 'test',
raw: {
_index: 'test_i',
_score: 1,
_id: 'test',
},
flattened: { test: jest.fn() },
Expand Down Expand Up @@ -845,6 +847,7 @@ describe('UnifiedDataTable', () => {
id: 'test',
raw: {
_index: 'test_i',
_score: 1,
_id: 'test',
},
flattened: { test: jest.fn() },
Expand All @@ -868,6 +871,7 @@ describe('UnifiedDataTable', () => {
id: 'test',
raw: {
_index: 'test_i',
_score: 1,
_id: 'test',
},
flattened: { test: jest.fn() },
Expand Down Expand Up @@ -983,6 +987,7 @@ describe('UnifiedDataTable', () => {
id: 'test',
raw: {
_index: 'test_i',
_score: 1,
_id: 'test',
},
flattened: { test: jest.fn() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('document selection', () => {
const doc = {
_id: 'test-id',
_index: 'test-indices',
_score: 1,
_routing: 'why-not',
};
expect(getDocId(doc)).toMatchInlineSnapshot(`"test-indices::test-id::why-not"`);
Expand All @@ -44,6 +45,7 @@ describe('document selection', () => {
const doc = {
_id: 'test-id',
_index: 'test-indices',
_score: 1,
};
expect(getDocId(doc)).toMatchInlineSnapshot(`"test-indices::test-id::"`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('<DocViewer />', () => {
},
});
const renderProps = {
hit: buildDataTableRecord({ _index: 't', _id: '1' }),
hit: buildDataTableRecord({ _index: 't', _score: 1, _id: '1' }),
} as DocViewRenderProps;
render(<WrappedDocViewer docViews={registry.getAll()} {...renderProps} />);
expect(screen.getByTestId('sectionErrorBoundaryPromptBody')).toBeInTheDocument();
Expand All @@ -106,7 +106,7 @@ describe('<DocViewer />', () => {
},
});
const renderProps = {
hit: buildDataTableRecord({ _index: 't', _id: '1' }),
hit: buildDataTableRecord({ _index: 't', _score: 1, _id: '1' }),
} as DocViewRenderProps;
render(<WrappedDocViewer docViews={registry.getAll()} {...renderProps} />);
expect(screen.queryByTestId('sectionErrorBoundaryPromptBody')).not.toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('APM Stacktrace component', () => {
const comp = mountWithIntl(
<ApmStacktrace
hit={{
raw: { _id: '1', _index: 'index1' },
raw: { _id: '1', _score: 1, _index: 'index1' },
flattened: {},
id: '',
}}
Expand All @@ -46,7 +46,7 @@ describe('APM Stacktrace component', () => {
const comp = mountWithIntl(
<ApmStacktrace
hit={{
raw: { _id: '1', _index: 'index1' },
raw: { _id: '1', _score: 1, _index: 'index1' },
flattened: {},
id: '',
}}
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('APM Stacktrace component', () => {
<EuiThemeProvider>
<ApmStacktrace
hit={{
raw: { _id: '1', _index: 'index1' },
raw: { _id: '1', _score: 1, _index: 'index1' },
flattened: {},
id: '',
}}
Expand Down Expand Up @@ -167,7 +167,7 @@ describe('APM Stacktrace component', () => {
<EuiThemeProvider>
<ApmStacktrace
hit={{
raw: { _id: '1', _index: 'index1' },
raw: { _id: '1', _score: 1, _index: 'index1' },
flattened: {},
id: '',
}}
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('APM Stacktrace component', () => {
<EuiThemeProvider>
<ApmStacktrace
hit={{
raw: { _id: '1', _index: 'index1' },
raw: { _id: '1', _score: 1, _index: 'index1' },
flattened: {},
id: '',
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ describe('Source Viewer component', () => {
const record = {
_index: 'logstash-2014.09.09',
_id: 'id123',
_score: 1,
message: 'Lorem ipsum dolor sit amet',
extension: 'html',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('getPinControl', () => {
_ignored: [],
_index: 'test',
_id: '1',
_score: 1,
_source: {
message: 'test',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('TableActions', () => {
_ignored: [],
_index: 'test',
_id: '1',
_score: 1,
_source: {
[fieldName]: fieldValue,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const hit = buildDataTableRecord(
{
_ignored: [],
_index: 'test',
_score: 1,
_id: '1',
_source: {
'extension.keyword': 'zip',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,7 @@ describe('transformResponse', () => {
...lastRunResponse,
hits: {
total: { value: 1, relation: 'eq' },
max_score: lastRunResponse.hits.max_score,
hits: [lastRunResponse.hits.hits[0]],
},
};
Expand Down
Loading