diff --git a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/fixtures/processed_search_response.ts b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/fixtures/processed_search_response.ts index 4ac34228e16b4e..ede36ba2b01699 100644 --- a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/fixtures/processed_search_response.ts +++ b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/fixtures/processed_search_response.ts @@ -3,2442 +3,342 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +import { produce } from 'immer'; -// export const processedSearchResponse = [ -// { -// shards: [ -// { -// id: ['L22w_FX2SbqlQYOP5QrYDg', '.kibana_1', '0'], -// searches: [ -// { -// query: null, -// rewrite_time: 14670, -// collector: [ -// { -// name: 'CancellableCollector', -// reason: 'search_cancelled', -// time_in_nanos: 14706, -// children: [ -// { -// name: 'SimpleTopScoreDocCollector', -// reason: 'search_top_hits', -// time_in_nanos: 7851, -// }, -// ], -// }, -// ], -// flat: [ -// { -// id: '8a255249-69bb-4940-a1e1-72cc328063cd', -// childrenIds: ['99f8e252-ad42-4b26-a8c2-7ce951d8c13f'], -// lucene: 'ConstantScore(DocValuesFieldExistsQuery [field=_primary_term])', -// time: 0.058419, -// selfTime: 0.028784999999999998, -// timePercentage: '100.00', -// query_type: 'ConstantScoreQuery', -// absoluteColor: '#ffafaf', -// depth: 0, -// hasChildren: true, -// breakdown: [ -// { -// key: 'build_scorer', -// time: 40061, -// relative: '68.7', -// color: '#fcc5c5', -// tip: -// 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', -// }, -// { -// key: 'create_weight', -// time: 8238, -// relative: '14.1', -// color: '#f6ebeb', -// tip: -// 'The time taken to create the Weight object, which holds temporary information during scoring.', -// }, -// { -// key: 'next_doc', -// time: 5767, -// relative: '9.9', -// color: '#f6eeee', -// tip: 'The time taken to advance the iterator to the next matching document.', -// }, -// { -// key: 'advance', -// time: 2849, -// relative: '4.9', -// color: '#f5f2f2', -// tip: 'The time taken to advance the iterator to the next document.', -// }, -// { -// key: 'score', -// time: 1431, -// relative: '2.5', -// color: '#f5f3f3', -// tip: 'The time taken in actually scoring the document against the query.', -// }, -// { -// key: 'next_doc_count', -// time: 24, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'score_count', -// time: 24, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'build_scorer_count', -// time: 16, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'advance_count', -// time: 8, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'create_weight_count', -// time: 1, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'match', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: -// 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', -// }, -// { -// key: 'match_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// ], -// }, -// { -// id: '99f8e252-ad42-4b26-a8c2-7ce951d8c13f', -// parentId: '8a255249-69bb-4940-a1e1-72cc328063cd', -// childrenIds: [], -// lucene: 'DocValuesFieldExistsQuery [field=_primary_term]', -// time: 0.029634, -// selfTime: 0.029634, -// timePercentage: '50.73', -// query_type: 'DocValuesFieldExistsQuery', -// absoluteColor: '#fad1d1', -// depth: 1, -// breakdown: [ -// { -// key: 'build_scorer', -// time: 24059, -// relative: '81.3', -// color: '#fdbcbc', -// tip: -// 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', -// }, -// { -// key: 'next_doc', -// time: 2434, -// relative: '8.2', -// color: '#f6efef', -// tip: 'The time taken to advance the iterator to the next matching document.', -// }, -// { -// key: 'create_weight', -// time: 1586, -// relative: '5.4', -// color: '#f6f1f1', -// tip: -// 'The time taken to create the Weight object, which holds temporary information during scoring.', -// }, -// { -// key: 'advance', -// time: 1506, -// relative: '5.1', -// color: '#f6f1f1', -// tip: 'The time taken to advance the iterator to the next document.', -// }, -// { -// key: 'next_doc_count', -// time: 24, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'build_scorer_count', -// time: 16, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'advance_count', -// time: 8, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'create_weight_count', -// time: 1, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'match', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: -// 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', -// }, -// { -// key: 'match_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: 'The time taken in actually scoring the document against the query.', -// }, -// { -// key: 'score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// ], -// }, -// ], -// }, -// ], -// aggregations: [], -// time: { -// searches: 0.058419, -// aggregations: 0, -// }, -// color: { -// searches: '#ffafaf', -// aggregations: 0, -// }, -// relative: { -// searches: '100.00', -// aggregations: 0, -// }, -// rewrite_time: 14670, -// }, -// ], -// time: { -// searches: 0.058419, -// aggregations: 0, -// }, -// name: '.kibana_1', -// }, -// { -// shards: [ -// { -// id: ['L22w_FX2SbqlQYOP5QrYDg', '.kibana_task_manager_1', '0'], -// searches: [ -// { -// query: null, -// rewrite_time: 10713, -// collector: [ -// { -// name: 'CancellableCollector', -// reason: 'search_cancelled', -// time_in_nanos: 4924, -// children: [ -// { -// name: 'SimpleTopScoreDocCollector', -// reason: 'search_top_hits', -// time_in_nanos: 2223, -// }, -// ], -// }, -// ], -// flat: [ -// { -// id: 'a846ca64-d3b1-4742-9242-bcf8ece1899c', -// childrenIds: ['1bad0716-a813-4989-af2c-955c6ca2daa3'], -// lucene: 'ConstantScore(DocValuesFieldExistsQuery [field=_primary_term])', -// time: 0.030013, -// selfTime: 0.010218000000000001, -// timePercentage: '100.00', -// query_type: 'ConstantScoreQuery', -// absoluteColor: '#ffafaf', -// depth: 0, -// hasChildren: true, -// breakdown: [ -// { -// key: 'build_scorer', -// time: 20404, -// relative: '68.0', -// color: '#fcc5c5', -// tip: -// 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', -// }, -// { -// key: 'create_weight', -// time: 6727, -// relative: '22.4', -// color: '#f7e5e5', -// tip: -// 'The time taken to create the Weight object, which holds temporary information during scoring.', -// }, -// { -// key: 'next_doc', -// time: 1497, -// relative: '5.0', -// color: '#f6f2f2', -// tip: 'The time taken to advance the iterator to the next matching document.', -// }, -// { -// key: 'advance', -// time: 1058, -// relative: '3.5', -// color: '#f5f3f3', -// tip: 'The time taken to advance the iterator to the next document.', -// }, -// { -// key: 'score', -// time: 309, -// relative: '1.0', -// color: '#f5f4f4', -// tip: 'The time taken in actually scoring the document against the query.', -// }, -// { -// key: 'build_scorer_count', -// time: 6, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'next_doc_count', -// time: 5, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'advance_count', -// time: 3, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'score_count', -// time: 3, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'create_weight_count', -// time: 1, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'match', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: -// 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', -// }, -// { -// key: 'match_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// ], -// }, -// { -// id: '1bad0716-a813-4989-af2c-955c6ca2daa3', -// parentId: 'a846ca64-d3b1-4742-9242-bcf8ece1899c', -// childrenIds: [], -// lucene: 'DocValuesFieldExistsQuery [field=_primary_term]', -// time: 0.019795, -// selfTime: 0.019795, -// timePercentage: '65.95', -// query_type: 'DocValuesFieldExistsQuery', -// absoluteColor: '#fcc7c7', -// depth: 1, -// breakdown: [ -// { -// key: 'build_scorer', -// time: 17681, -// relative: '89.4', -// color: '#feb6b6', -// tip: -// 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', -// }, -// { -// key: 'create_weight', -// time: 1121, -// relative: '5.7', -// color: '#f6f1f1', -// tip: -// 'The time taken to create the Weight object, which holds temporary information during scoring.', -// }, -// { -// key: 'next_doc', -// time: 600, -// relative: '3.0', -// color: '#f5f3f3', -// tip: 'The time taken to advance the iterator to the next matching document.', -// }, -// { -// key: 'advance', -// time: 378, -// relative: '1.9', -// color: '#f5f4f4', -// tip: 'The time taken to advance the iterator to the next document.', -// }, -// { -// key: 'build_scorer_count', -// time: 6, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'next_doc_count', -// time: 5, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'advance_count', -// time: 3, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'create_weight_count', -// time: 1, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'match', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: -// 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', -// }, -// { -// key: 'match_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: 'The time taken in actually scoring the document against the query.', -// }, -// { -// key: 'score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// ], -// }, -// ], -// }, -// ], -// aggregations: [], -// time: { -// searches: 0.030013, -// aggregations: 0, -// }, -// color: { -// searches: '#ffafaf', -// aggregations: 0, -// }, -// relative: { -// searches: '100.00', -// aggregations: 0, -// }, -// rewrite_time: 10713, -// }, -// ], -// time: { -// searches: 0.030013, -// aggregations: 0, -// }, -// name: '.kibana_task_manager_1', -// }, -// { -// shards: [ -// { -// id: ['L22w_FX2SbqlQYOP5QrYDg', '.security-7', '0'], -// searches: [ -// { -// query: null, -// rewrite_time: 755, -// collector: [ -// { -// name: 'CancellableCollector', -// reason: 'search_cancelled', -// time_in_nanos: 18172, -// children: [ -// { -// name: 'SimpleTopScoreDocCollector', -// reason: 'search_top_hits', -// time_in_nanos: 12507, -// }, -// ], -// }, -// ], -// flat: [ -// { -// id: 'd4f41ceb-53b2-4530-a418-b84f72ac4fe6', -// childrenIds: [], -// lucene: '*:*', -// time: 0.013254, -// selfTime: 0.013254, -// timePercentage: '100.00', -// query_type: 'MatchAllDocsQuery', -// absoluteColor: '#ffafaf', -// depth: 0, -// breakdown: [ -// { -// key: 'build_scorer', -// time: 5137, -// relative: '38.9', -// color: '#f9dada', -// tip: -// 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', -// }, -// { -// key: 'set_min_competitive_score', -// time: 3016, -// relative: '22.8', -// color: '#f7e5e5', -// tip: '', -// }, -// { -// key: 'next_doc', -// time: 1442, -// relative: '10.9', -// color: '#f6eded', -// tip: 'The time taken to advance the iterator to the next matching document.', -// }, -// { -// key: 'advance', -// time: 1313, -// relative: '9.9', -// color: '#f6eeee', -// tip: 'The time taken to advance the iterator to the next document.', -// }, -// { -// key: 'score', -// time: 1169, -// relative: '8.9', -// color: '#f6efef', -// tip: 'The time taken in actually scoring the document against the query.', -// }, -// { -// key: 'create_weight', -// time: 1132, -// relative: '8.6', -// color: '#f6efef', -// tip: -// 'The time taken to create the Weight object, which holds temporary information during scoring.', -// }, -// { -// key: 'build_scorer_count', -// time: 12, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'next_doc_count', -// time: 10, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'score_count', -// time: 10, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'advance_count', -// time: 6, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score_count', -// time: 6, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'create_weight_count', -// time: 1, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'match', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: -// 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', -// }, -// { -// key: 'match_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// ], -// }, -// ], -// }, -// ], -// aggregations: [], -// time: { -// searches: 0.013254, -// aggregations: 0, -// }, -// color: { -// searches: '#ffafaf', -// aggregations: 0, -// }, -// relative: { -// searches: '100.00', -// aggregations: 0, -// }, -// rewrite_time: 755, -// }, -// ], -// time: { -// searches: 0.013254, -// aggregations: 0, -// }, -// name: '.security-7', -// }, -// { -// shards: [ -// { -// id: ['L22w_FX2SbqlQYOP5QrYDg', 'kibana_sample_data_logs', '0'], -// searches: [ -// { -// query: null, -// rewrite_time: 691, -// collector: [ -// { -// name: 'CancellableCollector', -// reason: 'search_cancelled', -// time_in_nanos: 17700, -// children: [ -// { -// name: 'SimpleTopScoreDocCollector', -// reason: 'search_top_hits', -// time_in_nanos: 12839, -// }, -// ], -// }, -// ], -// flat: [ -// { -// id: '891975b0-2877-44e6-9f76-22c795d24ff8', -// childrenIds: [], -// lucene: '*:*', -// time: 0.012764, -// selfTime: 0.012764, -// timePercentage: '100.00', -// query_type: 'MatchAllDocsQuery', -// absoluteColor: '#ffafaf', -// depth: 0, -// breakdown: [ -// { -// key: 'build_scorer', -// time: 4783, -// relative: '37.6', -// color: '#f9dbdb', -// tip: -// 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', -// }, -// { -// key: 'set_min_competitive_score', -// time: 2685, -// relative: '21.1', -// color: '#f7e6e6', -// tip: '', -// }, -// { -// key: 'next_doc', -// time: 1831, -// relative: '14.4', -// color: '#f6ebeb', -// tip: 'The time taken to advance the iterator to the next matching document.', -// }, -// { -// key: 'advance', -// time: 1621, -// relative: '12.7', -// color: '#f6ecec', -// tip: 'The time taken to advance the iterator to the next document.', -// }, -// { -// key: 'create_weight', -// time: 972, -// relative: '7.6', -// color: '#f6f0f0', -// tip: -// 'The time taken to create the Weight object, which holds temporary information during scoring.', -// }, -// { -// key: 'score', -// time: 835, -// relative: '6.6', -// color: '#f6f0f0', -// tip: 'The time taken in actually scoring the document against the query.', -// }, -// { -// key: 'next_doc_count', -// time: 10, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'score_count', -// time: 10, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'build_scorer_count', -// time: 8, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'advance_count', -// time: 4, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score_count', -// time: 4, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'create_weight_count', -// time: 1, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'match', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: -// 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', -// }, -// { -// key: 'match_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// ], -// }, -// ], -// }, -// ], -// aggregations: [], -// time: { -// searches: 0.012764, -// aggregations: 0, -// }, -// color: { -// searches: '#ffafaf', -// aggregations: 0, -// }, -// relative: { -// searches: '100.00', -// aggregations: 0, -// }, -// rewrite_time: 691, -// }, -// ], -// time: { -// searches: 0.012764, -// aggregations: 0, -// }, -// name: 'kibana_sample_data_logs', -// }, -// { -// shards: [ -// { -// id: ['L22w_FX2SbqlQYOP5QrYDg', '.apm-agent-configuration', '0'], -// searches: [ -// { -// query: null, -// rewrite_time: 908, -// collector: [ -// { -// name: 'CancellableCollector', -// reason: 'search_cancelled', -// time_in_nanos: 1176, -// children: [ -// { -// name: 'SimpleTopScoreDocCollector', -// reason: 'search_top_hits', -// time_in_nanos: 517, -// }, -// ], -// }, -// ], -// flat: [ -// { -// id: 'ae115290-0daa-47e7-8985-7cc41016f070', -// childrenIds: [], -// lucene: '*:*', -// time: 0.001971, -// selfTime: 0.001971, -// timePercentage: '100.00', -// query_type: 'MatchAllDocsQuery', -// absoluteColor: '#ffafaf', -// depth: 0, -// breakdown: [ -// { -// key: 'create_weight', -// time: 1970, -// relative: '100.0', -// color: '#ffafaf', -// tip: -// 'The time taken to create the Weight object, which holds temporary information during scoring.', -// }, -// { -// key: 'create_weight_count', -// time: 1, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'advance', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: 'The time taken to advance the iterator to the next document.', -// }, -// { -// key: 'advance_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'build_scorer', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: -// 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', -// }, -// { -// key: 'build_scorer_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'compute_max_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'match', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: -// 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', -// }, -// { -// key: 'match_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'next_doc', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: 'The time taken to advance the iterator to the next matching document.', -// }, -// { -// key: 'next_doc_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: 'The time taken in actually scoring the document against the query.', -// }, -// { -// key: 'score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'set_min_competitive_score_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance', -// time: 0, -// relative: '0.0', -// color: '#f5f5f5', -// tip: '', -// }, -// { -// key: 'shallow_advance_count', -// time: 0, -// relative: 0, -// color: '#f5f5f5', -// tip: '', -// }, -// ], -// }, -// ], -// }, -// ], -// aggregations: [], -// time: { -// searches: 0.001971, -// aggregations: 0, -// }, -// color: { -// searches: '#ffafaf', -// aggregations: 0, -// }, -// relative: { -// searches: '100.00', -// aggregations: 0, -// }, -// rewrite_time: 908, -// }, -// ], -// time: { -// searches: 0.001971, -// aggregations: 0, -// }, -// name: '.apm-agent-configuration', -// }, -// ]; -export const processedSearchResponseNew = [ +const shard1 = { + id: ['L22w_FX2SbqlQYOP5QrYDg', '.kibana_1', '0'], + searches: [], + aggregations: [], + time: 0.058419, + color: '#ffafaf', + relative: '100.00', + rewrite_time: 14670, +}; + +const searchRoot = { + query: null, + rewrite_time: 14670, + collector: [ + { + name: 'CancellableCollector', + reason: 'search_cancelled', + time_in_nanos: 14706, + children: [ + { + name: 'SimpleTopScoreDocCollector', + reason: 'search_top_hits', + time_in_nanos: 7851, + }, + ], + }, + ], + treeRoot: null, +}; + +const search1 = { + type: 'ConstantScoreQuery', + description: 'ConstantScore(DocValuesFieldExistsQuery [field=_primary_term])', + time_in_nanos: 58419, + breakdown: [ + { + key: 'build_scorer', + time: 40061, + relative: '68.7', + color: '#fcc5c5', + tip: + 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', + }, + { + key: 'create_weight', + time: 8238, + relative: '14.1', + color: '#f6ebeb', + tip: + 'The time taken to create the Weight object, which holds temporary information during scoring.', + }, + { + key: 'next_doc', + time: 5767, + relative: '9.9', + color: '#f6eeee', + tip: 'The time taken to advance the iterator to the next matching document.', + }, + { + key: 'advance', + time: 2849, + relative: '4.9', + color: '#f5f2f2', + tip: 'The time taken to advance the iterator to the next document.', + }, + { + key: 'score', + time: 1431, + relative: '2.5', + color: '#f5f3f3', + tip: 'The time taken in actually scoring the document against the query.', + }, + { + key: 'next_doc_count', + time: 24, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'score_count', + time: 24, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'build_scorer_count', + time: 16, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'advance_count', + time: 8, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'create_weight_count', + time: 1, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'compute_max_score', + time: 0, + relative: '0.0', + color: '#f5f5f5', + tip: '', + }, + { + key: 'compute_max_score_count', + time: 0, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'match', + time: 0, + relative: '0.0', + color: '#f5f5f5', + tip: + 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', + }, + { + key: 'match_count', + time: 0, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'set_min_competitive_score', + time: 0, + relative: '0.0', + color: '#f5f5f5', + tip: '', + }, + { + key: 'set_min_competitive_score_count', + time: 0, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'shallow_advance', + time: 0, + relative: '0.0', + color: '#f5f5f5', + tip: '', + }, + { + key: 'shallow_advance_count', + time: 0, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + ], + children: [ + /* See search1Child */ + ], + hasChildren: true, + selfTime: 0.028784999999999998, + timePercentage: '100.00', + absoluteColor: '#ffafaf', + depth: 0, + parent: null, + time: 0.058419, + lucene: 'ConstantScore(DocValuesFieldExistsQuery [field=_primary_term])', + query_type: 'ConstantScoreQuery', + visible: true, +}; + +const search1Child = { + type: 'DocValuesFieldExistsQuery', + description: 'DocValuesFieldExistsQuery [field=_primary_term]', + time_in_nanos: 29634, + breakdown: [ + { + key: 'build_scorer', + time: 24059, + relative: '81.3', + color: '#fdbcbc', + tip: + 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', + }, + { + key: 'next_doc', + time: 2434, + relative: '8.2', + color: '#f6efef', + tip: 'The time taken to advance the iterator to the next matching document.', + }, + { + key: 'create_weight', + time: 1586, + relative: '5.4', + color: '#f6f1f1', + tip: + 'The time taken to create the Weight object, which holds temporary information during scoring.', + }, + { + key: 'advance', + time: 1506, + relative: '5.1', + color: '#f6f1f1', + tip: 'The time taken to advance the iterator to the next document.', + }, + { + key: 'next_doc_count', + time: 24, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'build_scorer_count', + time: 16, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'advance_count', + time: 8, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'create_weight_count', + time: 1, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'compute_max_score', + time: 0, + relative: '0.0', + color: '#f5f5f5', + tip: '', + }, + { + key: 'compute_max_score_count', + time: 0, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'match', + time: 0, + relative: '0.0', + color: '#f5f5f5', + tip: + 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', + }, + { + key: 'match_count', + time: 0, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'score', + time: 0, + relative: '0.0', + color: '#f5f5f5', + tip: 'The time taken in actually scoring the document against the query.', + }, + { + key: 'score_count', + time: 0, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'set_min_competitive_score', + time: 0, + relative: '0.0', + color: '#f5f5f5', + tip: '', + }, + { + key: 'set_min_competitive_score_count', + time: 0, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + { + key: 'shallow_advance', + time: 0, + relative: '0.0', + color: '#f5f5f5', + tip: '', + }, + { + key: 'shallow_advance_count', + time: 0, + relative: 0, + color: '#f5f5f5', + tip: '', + }, + ], + selfTime: 0.029634, + timePercentage: '50.73', + absoluteColor: '#fad1d1', + depth: 1, + parent: search1, + time: 0.029634, + lucene: 'DocValuesFieldExistsQuery [field=_primary_term]', + query_type: 'DocValuesFieldExistsQuery', + visible: true, +}; +(search1.children[0] as any) = search1Child; +(searchRoot.treeRoot as any) = search1; +(shard1.searches[0] as any) = searchRoot; + +export const processedResponseWithFirstShard = produce(null, () => [ { - shards: [ - { - id: ['L22w_FX2SbqlQYOP5QrYDg', '.kibana_1', '0'], - searches: [ - { - query: null, - rewrite_time: 14670, - collector: [ - { - name: 'CancellableCollector', - reason: 'search_cancelled', - time_in_nanos: 14706, - children: [ - { - name: 'SimpleTopScoreDocCollector', - reason: 'search_top_hits', - time_in_nanos: 7851, - }, - ], - }, - ], - treeRoot: { - type: 'ConstantScoreQuery', - description: 'ConstantScore(DocValuesFieldExistsQuery [field=_primary_term])', - time_in_nanos: 58419, - breakdown: [ - { - key: 'build_scorer', - time: 40061, - relative: '68.7', - color: '#fcc5c5', - tip: - 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', - }, - { - key: 'create_weight', - time: 8238, - relative: '14.1', - color: '#f6ebeb', - tip: - 'The time taken to create the Weight object, which holds temporary information during scoring.', - }, - { - key: 'next_doc', - time: 5767, - relative: '9.9', - color: '#f6eeee', - tip: 'The time taken to advance the iterator to the next matching document.', - }, - { - key: 'advance', - time: 2849, - relative: '4.9', - color: '#f5f2f2', - tip: 'The time taken to advance the iterator to the next document.', - }, - { - key: 'score', - time: 1431, - relative: '2.5', - color: '#f5f3f3', - tip: 'The time taken in actually scoring the document against the query.', - }, - { - key: 'next_doc_count', - time: 24, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'score_count', - time: 24, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'build_scorer_count', - time: 16, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'advance_count', - time: 8, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'create_weight_count', - time: 1, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'match', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: - 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', - }, - { - key: 'match_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - ], - children: [ - { - type: 'DocValuesFieldExistsQuery', - description: 'DocValuesFieldExistsQuery [field=_primary_term]', - time_in_nanos: 29634, - breakdown: [ - { - key: 'build_scorer', - time: 24059, - relative: '81.3', - color: '#fdbcbc', - tip: - 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', - }, - { - key: 'next_doc', - time: 2434, - relative: '8.2', - color: '#f6efef', - tip: 'The time taken to advance the iterator to the next matching document.', - }, - { - key: 'create_weight', - time: 1586, - relative: '5.4', - color: '#f6f1f1', - tip: - 'The time taken to create the Weight object, which holds temporary information during scoring.', - }, - { - key: 'advance', - time: 1506, - relative: '5.1', - color: '#f6f1f1', - tip: 'The time taken to advance the iterator to the next document.', - }, - { - key: 'next_doc_count', - time: 24, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'build_scorer_count', - time: 16, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'advance_count', - time: 8, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'create_weight_count', - time: 1, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'match', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: - 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', - }, - { - key: 'match_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: 'The time taken in actually scoring the document against the query.', - }, - { - key: 'score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - ], - selfTime: 0.029634, - getParent() {}, - timePercentage: '50.73', - absoluteColor: '#fad1d1', - depth: 1, - time: 0.029634, - lucene: 'DocValuesFieldExistsQuery [field=_primary_term]', - query_type: 'DocValuesFieldExistsQuery', - visible: true, - }, - ], - hasChildren: true, - getParent() {}, - selfTime: 0.028784999999999998, - timePercentage: '100.00', - absoluteColor: '#ffafaf', - depth: 0, - time: 0.058419, - lucene: 'ConstantScore(DocValuesFieldExistsQuery [field=_primary_term])', - query_type: 'ConstantScoreQuery', - visible: true, - }, - }, - ], - aggregations: [], - time: 0.058419, - color: '#ffafaf', - relative: '100.00', - rewrite_time: 14670, - }, - ], + shards: [shard1], time: 0.058419, name: '.kibana_1', visible: false, }, - { - shards: [ - { - id: ['L22w_FX2SbqlQYOP5QrYDg', '.kibana_task_manager_1', '0'], - searches: [ - { - query: null, - rewrite_time: 10713, - collector: [ - { - name: 'CancellableCollector', - reason: 'search_cancelled', - time_in_nanos: 4924, - children: [ - { - name: 'SimpleTopScoreDocCollector', - reason: 'search_top_hits', - time_in_nanos: 2223, - }, - ], - }, - ], - treeRoot: { - type: 'ConstantScoreQuery', - description: 'ConstantScore(DocValuesFieldExistsQuery [field=_primary_term])', - time_in_nanos: 30013, - breakdown: [ - { - key: 'build_scorer', - time: 20404, - relative: '68.0', - color: '#fcc5c5', - tip: - 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', - }, - { - key: 'create_weight', - time: 6727, - relative: '22.4', - color: '#f7e5e5', - tip: - 'The time taken to create the Weight object, which holds temporary information during scoring.', - }, - { - key: 'next_doc', - time: 1497, - relative: '5.0', - color: '#f6f2f2', - tip: 'The time taken to advance the iterator to the next matching document.', - }, - { - key: 'advance', - time: 1058, - relative: '3.5', - color: '#f5f3f3', - tip: 'The time taken to advance the iterator to the next document.', - }, - { - key: 'score', - time: 309, - relative: '1.0', - color: '#f5f4f4', - tip: 'The time taken in actually scoring the document against the query.', - }, - { - key: 'build_scorer_count', - time: 6, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'next_doc_count', - time: 5, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'advance_count', - time: 3, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'score_count', - time: 3, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'create_weight_count', - time: 1, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'match', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: - 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', - }, - { - key: 'match_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - ], - getParent() {}, - children: [ - { - type: 'DocValuesFieldExistsQuery', - description: 'DocValuesFieldExistsQuery [field=_primary_term]', - time_in_nanos: 19795, - getParent() {}, - breakdown: [ - { - key: 'build_scorer', - time: 17681, - relative: '89.4', - color: '#feb6b6', - tip: - 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', - }, - { - key: 'create_weight', - time: 1121, - relative: '5.7', - color: '#f6f1f1', - tip: - 'The time taken to create the Weight object, which holds temporary information during scoring.', - }, - { - key: 'next_doc', - time: 600, - relative: '3.0', - color: '#f5f3f3', - tip: 'The time taken to advance the iterator to the next matching document.', - }, - { - key: 'advance', - time: 378, - relative: '1.9', - color: '#f5f4f4', - tip: 'The time taken to advance the iterator to the next document.', - }, - { - key: 'build_scorer_count', - time: 6, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'next_doc_count', - time: 5, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'advance_count', - time: 3, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'create_weight_count', - time: 1, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'match', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: - 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', - }, - { - key: 'match_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: 'The time taken in actually scoring the document against the query.', - }, - { - key: 'score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - ], - selfTime: 0.019795, - timePercentage: '65.95', - absoluteColor: '#fcc7c7', - depth: 1, - time: 0.019795, - lucene: 'DocValuesFieldExistsQuery [field=_primary_term]', - query_type: 'DocValuesFieldExistsQuery', - visible: true, - }, - ], - hasChildren: true, - selfTime: 0.010218000000000001, - timePercentage: '100.00', - absoluteColor: '#ffafaf', - depth: 0, - time: 0.030013, - lucene: 'ConstantScore(DocValuesFieldExistsQuery [field=_primary_term])', - query_type: 'ConstantScoreQuery', - visible: true, - }, - }, - ], - aggregations: [], - time: 0.030013, - color: '#ffafaf', - relative: '100.00', - rewrite_time: 10713, - }, - ], - time: 0.030013, - name: '.kibana_task_manager_1', - visible: false, - }, - { - shards: [ - { - id: ['L22w_FX2SbqlQYOP5QrYDg', '.security-7', '0'], - searches: [ - { - query: null, - rewrite_time: 755, - collector: [ - { - name: 'CancellableCollector', - reason: 'search_cancelled', - time_in_nanos: 18172, - children: [ - { - name: 'SimpleTopScoreDocCollector', - reason: 'search_top_hits', - time_in_nanos: 12507, - }, - ], - }, - ], - treeRoot: { - type: 'MatchAllDocsQuery', - description: '*:*', - time_in_nanos: 13254, - breakdown: [ - { - key: 'build_scorer', - time: 5137, - relative: '38.9', - color: '#f9dada', - tip: - 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', - }, - { - key: 'set_min_competitive_score', - time: 3016, - relative: '22.8', - color: '#f7e5e5', - tip: '', - }, - { - key: 'next_doc', - time: 1442, - relative: '10.9', - color: '#f6eded', - tip: 'The time taken to advance the iterator to the next matching document.', - }, - { - key: 'advance', - time: 1313, - relative: '9.9', - color: '#f6eeee', - tip: 'The time taken to advance the iterator to the next document.', - }, - { - key: 'score', - time: 1169, - relative: '8.9', - color: '#f6efef', - tip: 'The time taken in actually scoring the document against the query.', - }, - { - key: 'create_weight', - time: 1132, - relative: '8.6', - color: '#f6efef', - tip: - 'The time taken to create the Weight object, which holds temporary information during scoring.', - }, - { - key: 'build_scorer_count', - time: 12, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'next_doc_count', - time: 10, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'score_count', - time: 10, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'advance_count', - time: 6, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score_count', - time: 6, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'create_weight_count', - time: 1, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'match', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: - 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', - }, - { - key: 'match_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - ], - getParent() {}, - selfTime: 0.013254, - timePercentage: '100.00', - absoluteColor: '#ffafaf', - depth: 0, - time: 0.013254, - lucene: '*:*', - query_type: 'MatchAllDocsQuery', - visible: true, - }, - }, - ], - aggregations: [], - time: 0.013254, - color: '#ffafaf', - relative: '100.00', - rewrite_time: 755, - }, - ], - time: 0.013254, - name: '.security-7', - visible: false, - }, - { - shards: [ - { - id: ['L22w_FX2SbqlQYOP5QrYDg', 'kibana_sample_data_logs', '0'], - searches: [ - { - query: null, - rewrite_time: 691, - collector: [ - { - name: 'CancellableCollector', - reason: 'search_cancelled', - time_in_nanos: 17700, - children: [ - { - name: 'SimpleTopScoreDocCollector', - reason: 'search_top_hits', - time_in_nanos: 12839, - }, - ], - }, - ], - treeRoot: { - type: 'MatchAllDocsQuery', - description: '*:*', - time_in_nanos: 12764, - getParent() {}, - breakdown: [ - { - key: 'build_scorer', - time: 4783, - relative: '37.6', - color: '#f9dbdb', - tip: - 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', - }, - { - key: 'set_min_competitive_score', - time: 2685, - relative: '21.1', - color: '#f7e6e6', - tip: '', - }, - { - key: 'next_doc', - time: 1831, - relative: '14.4', - color: '#f6ebeb', - tip: 'The time taken to advance the iterator to the next matching document.', - }, - { - key: 'advance', - time: 1621, - relative: '12.7', - color: '#f6ecec', - tip: 'The time taken to advance the iterator to the next document.', - }, - { - key: 'create_weight', - time: 972, - relative: '7.6', - color: '#f6f0f0', - tip: - 'The time taken to create the Weight object, which holds temporary information during scoring.', - }, - { - key: 'score', - time: 835, - relative: '6.6', - color: '#f6f0f0', - tip: 'The time taken in actually scoring the document against the query.', - }, - { - key: 'next_doc_count', - time: 10, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'score_count', - time: 10, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'build_scorer_count', - time: 8, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'advance_count', - time: 4, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score_count', - time: 4, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'create_weight_count', - time: 1, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'match', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: - 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', - }, - { - key: 'match_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - ], - selfTime: 0.012764, - timePercentage: '100.00', - absoluteColor: '#ffafaf', - depth: 0, - time: 0.012764, - lucene: '*:*', - query_type: 'MatchAllDocsQuery', - visible: true, - }, - }, - ], - aggregations: [], - time: 0.012764, - color: '#ffafaf', - relative: '100.00', - rewrite_time: 691, - }, - ], - time: 0.012764, - name: 'kibana_sample_data_logs', - visible: false, - }, - { - shards: [ - { - id: ['L22w_FX2SbqlQYOP5QrYDg', '.apm-agent-configuration', '0'], - searches: [ - { - query: null, - rewrite_time: 908, - collector: [ - { - name: 'CancellableCollector', - reason: 'search_cancelled', - time_in_nanos: 1176, - children: [ - { - name: 'SimpleTopScoreDocCollector', - reason: 'search_top_hits', - time_in_nanos: 517, - }, - ], - }, - ], - treeRoot: { - type: 'MatchAllDocsQuery', - description: '*:*', - time_in_nanos: 1971, - getParent() {}, - breakdown: [ - { - key: 'create_weight', - time: 1970, - relative: '100.0', - color: '#ffafaf', - tip: - 'The time taken to create the Weight object, which holds temporary information during scoring.', - }, - { - key: 'create_weight_count', - time: 1, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'advance', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: 'The time taken to advance the iterator to the next document.', - }, - { - key: 'advance_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'build_scorer', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: - 'The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc.', - }, - { - key: 'build_scorer_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'compute_max_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'match', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: - 'The time taken to execute a secondary, more precise scoring phase (used by phrase queries).', - }, - { - key: 'match_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'next_doc', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: 'The time taken to advance the iterator to the next matching document.', - }, - { - key: 'next_doc_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: 'The time taken in actually scoring the document against the query.', - }, - { - key: 'score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'set_min_competitive_score_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance', - time: 0, - relative: '0.0', - color: '#f5f5f5', - tip: '', - }, - { - key: 'shallow_advance_count', - time: 0, - relative: 0, - color: '#f5f5f5', - tip: '', - }, - ], - selfTime: 0.001971, - timePercentage: '100.00', - absoluteColor: '#ffafaf', - depth: 0, - time: 0.001971, - lucene: '*:*', - query_type: 'MatchAllDocsQuery', - visible: true, - }, - }, - ], - aggregations: [], - time: 0.001971, - color: '#ffafaf', - relative: '100.00', - rewrite_time: 908, - }, - ], - time: 0.001971, - name: '.apm-agent-configuration', - visible: false, - }, -]; +]); diff --git a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/fixtures/search_response.ts b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/fixtures/search_response.ts index e0be9fc728f0ad..07582c5feed802 100644 --- a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/fixtures/search_response.ts +++ b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/fixtures/search_response.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -export const searchResponse = [ +export const searchResponse: any = [ { id: ['L22w_FX2SbqlQYOP5QrYDg', '.apm-agent-configuration', '0'], searches: [ diff --git a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/init_data.test.ts b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/init_data.test.ts index 0201a2a4cb902f..d0034e753c9a5e 100644 --- a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/init_data.test.ts +++ b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/__tests__/init_data.test.ts @@ -8,14 +8,15 @@ import { Shard } from '../../../types'; import { initDataFor } from '../init_data'; import { searchResponse } from './fixtures/search_response'; -import { processedSearchResponseNew } from './fixtures/processed_search_response'; +import { processedResponseWithFirstShard } from './fixtures/processed_search_response'; describe('ProfileTree init data', () => { test('provides the expected result', () => { const input: Shard[] = searchResponse as any; const actual = initDataFor('searches')(input); - expect(JSON.stringify(actual, null, 2)).toEqual( - JSON.stringify(processedSearchResponseNew, null, 2) - ); + + expect(actual[0].name).toEqual(processedResponseWithFirstShard[0].name); + const expectedFirstShard = processedResponseWithFirstShard[0].shards[0]; + expect(actual[0].shards[0]).toEqual(expectedFirstShard); }); }); diff --git a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/init_data.ts b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/init_data.ts index 8aaae5e676ade6..c0c4ef1dc95a4f 100644 --- a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/init_data.ts +++ b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/init_data.ts @@ -6,7 +6,7 @@ import { produce } from 'immer'; import { flow } from 'fp-ts/lib/function'; -import { Targets, Shard } from '../../types'; +import { Targets, Shard, ShardSerialized } from '../../types'; import { calcTimes, normalizeTimes, initTree, normalizeIndices, sortIndices } from './unsafe_utils'; import { IndexMap } from './types'; @@ -51,21 +51,14 @@ export function mutateSearchTimesTree(shard: Shard) { shard.time = shardTime; } -const initShards = (data: Shard[]) => - produce(data, draft => { - for (const shard of draft) { - if (shard.time == null) { - shard.time = 0; - } - - if (shard.color == null) { - shard.color = ''; - } - - if (shard.relative == null) { - shard.relative = 0; - } - } +const initShards = (data: ShardSerialized[]) => + produce(data, draft => { + return draft.map(s => ({ + ...s, + time: 0, + color: '', + relative: 0, + })); }); export const calculateShardValues = (target: Targets) => (data: Shard[]) => diff --git a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/profile_tree.tsx b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/profile_tree.tsx index ddb78a3a0315c9..e55a6535567708 100644 --- a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/profile_tree.tsx +++ b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/profile_tree.tsx @@ -10,12 +10,12 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { IndexDetails } from './index_details'; import { ShardDetails } from './shard_details'; import { initDataFor } from './init_data'; -import { Shard, Targets } from '../../types'; +import { Targets, ShardSerialized } from '../../types'; import { HighlightContextProvider } from './highlight_context'; -interface Props { +export interface Props { target: Targets; - data: Shard[]; + data: ShardSerialized[]; } export const ProfileTree = ({ data, target }: Props) => { @@ -23,19 +23,24 @@ export const ProfileTree = ({ data, target }: Props) => { return null; } - const profileTreeData = initDataFor(target)(data); + const sortedIndices = initDataFor(target)(data); return ( - {profileTreeData.map(index => ( - + {sortedIndices.map(index => ( + {index.shards.map(shard => ( - + ))} diff --git a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/shard_details/shard_details_tree.tsx b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/shard_details/shard_details_tree.tsx index 0ca59309611b02..b735b0d79bd72d 100644 --- a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/shard_details/shard_details_tree.tsx +++ b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/shard_details/shard_details_tree.tsx @@ -18,7 +18,7 @@ export interface Props { export const ShardDetailTree = ({ data }: Props) => { // Recursively render the tree structure const renderOperations = (operation: Operation): JSX.Element => { - const parent = operation.getParent(); + const parent = operation.parent; const parentVisible = parent ? parent.visible : false; return ( <> diff --git a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/shard_details/shard_details_tree_leaf.tsx b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/shard_details/shard_details_tree_leaf.tsx index a6a8a481e8e6e6..65724f2536eddf 100644 --- a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/shard_details/shard_details_tree_leaf.tsx +++ b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/shard_details/shard_details_tree_leaf.tsx @@ -5,8 +5,7 @@ */ import React, { useState } from 'react'; -import { EuiLink, EuiBadge, EuiCodeBlock } from '@elastic/eui'; -import { EuiIcon } from '@elastic/eui/src/components/icon/icon'; +import { EuiLink, EuiBadge, EuiCodeBlock, EuiIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { useHighlightTreeLeaf } from '../use_highlight_tree_leaf'; @@ -38,7 +37,7 @@ export const ShardDetailsTreeLeaf = ({ parentVisible, operation }: Props) => { {}} + onClick={() => setVisible(!visible)} > {operation.hasChildren ? ( diff --git a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/unsafe_utils.ts b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/unsafe_utils.ts index fd0e2e12de81d7..14197572bf65f9 100644 --- a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/unsafe_utils.ts +++ b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/components/profile_tree/unsafe_utils.ts @@ -163,9 +163,7 @@ export function initTree(data: Operation[], depth = 0, parent: Operation | nu } // Use named function for tests. - child.getParent = function getParent() { - return parent; - }; + child.parent = parent; child.time = timeInMilliseconds(child); child.lucene = child.description; child.query_type = child.type!.split('.').pop()!; diff --git a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/types.ts b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/types.ts index 7468dd92bfcc39..503156c344da4e 100644 --- a/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/types.ts +++ b/x-pack/legacy/plugins/searchprofiler/np_ready/public/application/types.ts @@ -31,9 +31,10 @@ export interface Index { visible: boolean; } -export interface FlattenedStats { - time: number; - selfTime: number; +export interface ShardSerialized { + id: string[]; + searches: Operation[]; + aggregations: Operation[]; } export interface Operation { @@ -45,7 +46,7 @@ export interface Operation { absoluteColor: string; time: number; - getParent(): Operation | null; + parent: Operation | null; children: Operation[]; // Only exists on top level