[Logs UI] Replace legacy es client usage in category examples (#100716)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
151f5fdee1
commit
61a49c6119
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type { estypes } from '@elastic/elasticsearch';
|
||||
import type { ILegacyScopedClusterClient } from 'src/core/server';
|
||||
import type { ElasticsearchClient } from 'src/core/server';
|
||||
import {
|
||||
compareDatasetsByMaximumAnomalyScore,
|
||||
getJobId,
|
||||
|
@ -136,7 +136,7 @@ export async function getLogEntryCategoryDatasets(
|
|||
|
||||
export async function getLogEntryCategoryExamples(
|
||||
context: {
|
||||
core: { elasticsearch: { legacy: { client: ILegacyScopedClusterClient } } };
|
||||
core: { elasticsearch: { client: { asCurrentUser: ElasticsearchClient } } };
|
||||
infra: {
|
||||
mlAnomalyDetectors: MlAnomalyDetectors;
|
||||
mlSystem: MlSystem;
|
||||
|
@ -402,7 +402,7 @@ async function fetchTopLogEntryCategoryHistograms(
|
|||
}
|
||||
|
||||
async function fetchLogEntryCategoryExamples(
|
||||
requestContext: { core: { elasticsearch: { legacy: { client: ILegacyScopedClusterClient } } } },
|
||||
requestContext: { core: { elasticsearch: { client: { asCurrentUser: ElasticsearchClient } } } },
|
||||
indices: string,
|
||||
runtimeMappings: estypes.RuntimeFields,
|
||||
timestampField: string,
|
||||
|
@ -417,19 +417,20 @@ async function fetchLogEntryCategoryExamples(
|
|||
const {
|
||||
hits: { hits },
|
||||
} = decodeOrThrow(logEntryCategoryExamplesResponseRT)(
|
||||
await requestContext.core.elasticsearch.legacy.client.callAsCurrentUser(
|
||||
'search',
|
||||
createLogEntryCategoryExamplesQuery(
|
||||
indices,
|
||||
runtimeMappings,
|
||||
timestampField,
|
||||
tiebreakerField,
|
||||
startTime,
|
||||
endTime,
|
||||
categoryQuery,
|
||||
exampleCount
|
||||
(
|
||||
await requestContext.core.elasticsearch.client.asCurrentUser.search(
|
||||
createLogEntryCategoryExamplesQuery(
|
||||
indices,
|
||||
runtimeMappings,
|
||||
timestampField,
|
||||
tiebreakerField,
|
||||
startTime,
|
||||
endTime,
|
||||
categoryQuery,
|
||||
exampleCount
|
||||
)
|
||||
)
|
||||
)
|
||||
).body
|
||||
);
|
||||
|
||||
const esSearchSpan = finalizeEsSearchSpan();
|
||||
|
|
Loading…
Reference in a new issue