66 */
77
88import type { estypes } from '@elastic/elasticsearch' ;
9- import type { ILegacyScopedClusterClient } from 'src/core/server' ;
9+ import type { ElasticsearchClient } from 'src/core/server' ;
1010import {
1111 compareDatasetsByMaximumAnomalyScore ,
1212 getJobId ,
@@ -136,7 +136,7 @@ export async function getLogEntryCategoryDatasets(
136136
137137export async function getLogEntryCategoryExamples (
138138 context : {
139- core : { elasticsearch : { legacy : { client : ILegacyScopedClusterClient } } } ;
139+ core : { elasticsearch : { client : { asCurrentUser : ElasticsearchClient } } } ;
140140 infra : {
141141 mlAnomalyDetectors : MlAnomalyDetectors ;
142142 mlSystem : MlSystem ;
@@ -402,7 +402,7 @@ async function fetchTopLogEntryCategoryHistograms(
402402}
403403
404404async function fetchLogEntryCategoryExamples (
405- requestContext : { core : { elasticsearch : { legacy : { client : ILegacyScopedClusterClient } } } } ,
405+ requestContext : { core : { elasticsearch : { client : { asCurrentUser : ElasticsearchClient } } } } ,
406406 indices : string ,
407407 runtimeMappings : estypes . RuntimeFields ,
408408 timestampField : string ,
@@ -417,19 +417,20 @@ async function fetchLogEntryCategoryExamples(
417417 const {
418418 hits : { hits } ,
419419 } = decodeOrThrow ( logEntryCategoryExamplesResponseRT ) (
420- await requestContext . core . elasticsearch . legacy . client . callAsCurrentUser (
421- 'search' ,
422- createLogEntryCategoryExamplesQuery (
423- indices ,
424- runtimeMappings ,
425- timestampField ,
426- tiebreakerField ,
427- startTime ,
428- endTime ,
429- categoryQuery ,
430- exampleCount
420+ (
421+ await requestContext . core . elasticsearch . client . asCurrentUser . search (
422+ createLogEntryCategoryExamplesQuery (
423+ indices ,
424+ runtimeMappings ,
425+ timestampField ,
426+ tiebreakerField ,
427+ startTime ,
428+ endTime ,
429+ categoryQuery ,
430+ exampleCount
431+ )
431432 )
432- )
433+ ) . body
433434 ) ;
434435
435436 const esSearchSpan = finalizeEsSearchSpan ( ) ;
0 commit comments