Skip to content

Commit

Permalink
use resolve api on client
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Mar 24, 2021
1 parent a1b42cb commit 131b956
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,9 @@ export function registerResolveIndexRoute(router: IRouter): void {
},
},
async (context, req, res) => {
const queryString = req.query.expand_wildcards
? { expand_wildcards: req.query.expand_wildcards }
: null;
const { body } = await context.core.elasticsearch.client.asCurrentUser.transport.request({
method: 'GET',
path: `/_resolve/index/${encodeURIComponent(req.params.query)}${
queryString ? '?' + new URLSearchParams(queryString).toString() : ''
}`,
const { body } = await context.core.elasticsearch.client.asCurrentUser.indices.resolveIndex({
name: req.params.query,
expand_wildcards: req.query.expand_wildcards || 'open',
});
return res.ok({ body });
}
Expand Down

0 comments on commit 131b956

Please sign in to comment.