Skip to content

Commit

Permalink
migrate integration tests to the new es client
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Jul 29, 2021
1 parent 12271f3 commit 26dd76c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions x-pack/test/api_integration/apis/metrics_ui/metrics_alerting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { MetricExpressionParams } from '../../../../plugins/infra/server/lib/ale

import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const client = getService('legacyEs');
const client = getService('es');
const index = 'test-index';
const getSearchParams = (aggType: string) =>
({
Expand Down Expand Up @@ -42,7 +42,7 @@ export default function ({ getService }: FtrProviderContext) {
'@timestamp',
timeframe
);
const result = await client.search({
const { body: result } = await client.search({
index,
body: searchBody,
});
Expand All @@ -63,7 +63,7 @@ export default function ({ getService }: FtrProviderContext) {
undefined,
'{"bool":{"should":[{"match_phrase":{"agent.hostname":"foo"}}],"minimum_should_match":1}}'
);
const result = await client.search({
const { body: result } = await client.search({
index,
body: searchBody,
});
Expand All @@ -85,7 +85,7 @@ export default function ({ getService }: FtrProviderContext) {
timeframe,
'agent.id'
);
const result = await client.search({
const { body: result } = await client.search({
index,
body: searchBody,
});
Expand All @@ -106,7 +106,7 @@ export default function ({ getService }: FtrProviderContext) {
'agent.id',
'{"bool":{"should":[{"match_phrase":{"agent.hostname":"foo"}}],"minimum_should_match":1}}'
);
const result = await client.search({
const { body: result } = await client.search({
index,
body: searchBody,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import * as beatsMetrics from '../../../../../plugins/monitoring/server/lib/metr
import * as apmMetrics from '../../../../../plugins/monitoring/server/lib/metrics/apm/metrics';

export default function ({ getService }) {
const es = getService('legacyEs');
const es = getService('es');

const metricSets = [
{
Expand Down Expand Up @@ -49,7 +49,7 @@ export default function ({ getService }) {
let mappings;

before('load mappings', async () => {
const template = await es.indices.getTemplate({ name: indexTemplate });
const { body: template } = await es.indices.getTemplate({ name: indexTemplate });
mappings = get(template, [indexTemplate, 'mappings', 'properties']);
});

Expand Down

0 comments on commit 26dd76c

Please sign in to comment.