Skip to content

Commit

Permalink
Index pattern management - use new es client instead of legacy (#95293)…
Browse files Browse the repository at this point in the history
… (#95467)

* use new es client instead of legacy

* use resolve api on client
  • Loading branch information
mattkime authored Mar 25, 2021
1 parent 97510d4 commit b43ad04
Showing 1 changed file with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,11 @@ export function registerResolveIndexRoute(router: IRouter): void {
},
},
async (context, req, res) => {
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.indices.resolveIndex({
name: req.params.query,
expand_wildcards: req.query.expand_wildcards || 'open',
});
return res.ok({ body });
}
);
}

0 comments on commit b43ad04

Please sign in to comment.