Skip to content

Commit

Permalink
Reverting changes to dataManagement es client and get data stream api…
Browse files Browse the repository at this point in the history
… route
  • Loading branch information
yuliacech committed Oct 22, 2020
1 parent 4155636 commit eff3b40
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 14 additions & 0 deletions x-pack/plugins/index_management/server/client/elasticsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any)
method: 'GET',
});

dataManagement.getDataStream = ca({
urls: [
{
fmt: '/_data_stream/<%=name%>',
req: {
name: {
type: 'string',
},
},
},
],
method: 'GET',
});

// We don't allow the user to create a data stream in the UI or API. We're just adding this here
// to enable the API integration tests.
dataManagement.createDataStream = ca({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,14 @@ export function registerGetOneRoute({ router, license, lib: { isEsError } }: Rou
},
license.guardApiRoute(async (ctx, req, res) => {
const { name } = req.params as TypeOf<typeof paramsSchema>;

const { callAsCurrentUser } = ctx.dataManagement!.client;
try {
const [
{ data_streams: dataStream },
{ data_streams: dataStreamsStats },
] = await Promise.all([
ctx.core.elasticsearch.legacy.client.callAsCurrentUser('transport.request', {
path: `/_data_stream/${encodeURIComponent(name)}`,
method: 'GET',
callAsCurrentUser('dataManagement.getDataStream', {
name,
}),
ctx.core.elasticsearch.legacy.client.callAsCurrentUser('transport.request', {
path: `/_data_stream/${encodeURIComponent(name)}/_stats`,
Expand Down

0 comments on commit eff3b40

Please sign in to comment.