Index pattern management - use new es client instead of legacy (#95293)
* use new es client instead of legacy * use resolve api on client
This commit is contained in:
parent
dd10c8b5f2
commit
306a42c03c
|
@ -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 });
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue