Skip to content

Commit

Permalink
use new es client instead of legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Mar 24, 2021
1 parent e6f4770 commit a1b42cb
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,13 @@ export function registerResolveIndexRoute(router: IRouter): void {
const queryString = req.query.expand_wildcards
? { expand_wildcards: req.query.expand_wildcards }
: null;
const result = await context.core.elasticsearch.legacy.client.callAsCurrentUser(
'transport.request',
{
method: 'GET',
path: `/_resolve/index/${encodeURIComponent(req.params.query)}${
queryString ? '?' + new URLSearchParams(queryString).toString() : ''
}`,
}
);
return res.ok({ body: result });
const { body } = await context.core.elasticsearch.client.asCurrentUser.transport.request({
method: 'GET',
path: `/_resolve/index/${encodeURIComponent(req.params.query)}${
queryString ? '?' + new URLSearchParams(queryString).toString() : ''
}`,
});
return res.ok({ body });
}
);
}

0 comments on commit a1b42cb

Please sign in to comment.