File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
x-pack/plugins/infra/public/utils Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 66
77import { encode } from 'rison-node' ;
88import { i18n } from '@kbn/i18n' ;
9+ import { SearchResponse } from 'src/plugins/data/public' ;
910import { DEFAULT_SOURCE_ID } from '../../common/constants' ;
1011import { InfraClientCoreSetup , InfraClientStartDeps } from '../types' ;
1112import {
@@ -89,9 +90,10 @@ async function fetchLogsOverview(
8990 params : FetchDataParams ,
9091 dataPlugin : InfraClientStartDeps [ 'data' ]
9192) : Promise < StatsAndSeries > {
92- const esSearcher = dataPlugin . search . getSearchStrategy ( 'es' ) ;
9393 return new Promise ( ( resolve , reject ) => {
94- esSearcher
94+ let esResponse : SearchResponse = { } ;
95+
96+ dataPlugin . search
9597 . search ( {
9698 params : {
9799 index : logParams . index ,
@@ -103,14 +105,15 @@ async function fetchLogsOverview(
103105 } ,
104106 } )
105107 . subscribe (
106- ( response ) => {
107- if ( response . rawResponse . aggregations ) {
108- resolve ( processLogsOverviewAggregations ( response . rawResponse . aggregations ) ) ;
108+ ( response ) => ( esResponse = response . rawResponse ) ,
109+ ( error ) => reject ( error ) ,
110+ ( ) => {
111+ if ( esResponse . aggregations ) {
112+ resolve ( processLogsOverviewAggregations ( esResponse . aggregations ) ) ;
109113 } else {
110114 resolve ( { stats : { } , series : { } } ) ;
111115 }
112- } ,
113- ( error ) => reject ( error )
116+ }
114117 ) ;
115118 } ) ;
116119}
You can’t perform that action at this time.
0 commit comments