Skip to content

Commit

Permalink
[transform] Fix API endpoints. (#48648)
Browse files Browse the repository at this point in the history
Fixes deprecated API endpoints _data_frame/transforms/ with the _transform/ replacement.
  • Loading branch information
walterra committed Oct 18, 2019
1 parent 5988818 commit a1caf19
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,7 @@ export const StepCreateForm: SFC<Props> = React.memo(
}

function getTransformConfigDevConsoleStatement() {
return `PUT _data_frame/transforms/${transformId}\n${JSON.stringify(
transformConfig,
null,
2
)}\n\n`;
return `PUT _transform/${transformId}\n${JSON.stringify(transformConfig, null, 2)}\n\n`;
}

// TODO move this to SASS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('Transform: Define Pivot Common', () => {
const request = getPreviewRequestBody('the-index-pattern-title', query, [groupBy], [agg]);
const pivotPreviewDevConsoleStatement = getPivotPreviewDevConsoleStatement(request);

expect(pivotPreviewDevConsoleStatement).toBe(`POST _data_frame/transforms/_preview
expect(pivotPreviewDevConsoleStatement).toBe(`POST _transform/_preview
{
"source": {
"index": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ export function getPivotDropdownOptions(indexPattern: IndexPattern) {
}

export const getPivotPreviewDevConsoleStatement = (request: PreviewRequestBody) => {
return `POST _data_frame/transforms/_preview\n${JSON.stringify(request, null, 2)}\n`;
return `POST _transform/_preview\n${JSON.stringify(request, null, 2)}\n`;
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any)
transform.getTransforms = ca({
urls: [
{
fmt: '/_data_frame/transforms/<%=transformId%>',
fmt: '/_transform/<%=transformId%>',
req: {
transformId: {
type: 'string',
},
},
},
{
fmt: '/_data_frame/transforms/_all?size=1000',
fmt: '/_transform/_all?size=1000',
},
],
method: 'GET',
Expand All @@ -33,7 +33,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any)
transform.getTransformsStats = ca({
urls: [
{
fmt: '/_data_frame/transforms/<%=transformId%>/_stats',
fmt: '/_transform/<%=transformId%>/_stats',
req: {
transformId: {
type: 'string',
Expand All @@ -44,7 +44,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any)
// Currently the endpoint uses a default size of 100 unless a size is supplied.
// So until paging is supported in the UI, explicitly supply a size of 1000
// to match the max number of docs that the endpoint can return.
fmt: '/_data_frame/transforms/_all/_stats?size=1000',
fmt: '/_transform/_all/_stats?size=1000',
},
],
method: 'GET',
Expand All @@ -53,7 +53,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any)
transform.createTransform = ca({
urls: [
{
fmt: '/_data_frame/transforms/<%=transformId%>',
fmt: '/_transform/<%=transformId%>',
req: {
transformId: {
type: 'string',
Expand All @@ -68,7 +68,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any)
transform.deleteTransform = ca({
urls: [
{
fmt: '/_data_frame/transforms/<%=transformId%>',
fmt: '/_transform/<%=transformId%>',
req: {
transformId: {
type: 'string',
Expand All @@ -82,7 +82,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any)
transform.getTransformsPreview = ca({
urls: [
{
fmt: '/_data_frame/transforms/_preview',
fmt: '/_transform/_preview',
},
],
needBody: true,
Expand All @@ -92,7 +92,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any)
transform.startTransform = ca({
urls: [
{
fmt: '/_data_frame/transforms/<%=transformId%>/_start',
fmt: '/_transform/<%=transformId%>/_start',
req: {
transformId: {
type: 'string',
Expand All @@ -107,7 +107,7 @@ export const elasticsearchJsPlugin = (Client: any, config: any, components: any)
urls: [
{
fmt:
'/_data_frame/transforms/<%=transformId%>/_stop?&force=<%=force%>&wait_for_completion=<%waitForCompletion%>',
'/_transform/<%=transformId%>/_stop?&force=<%=force%>&wait_for_completion=<%waitForCompletion%>',
req: {
transformId: {
type: 'string',
Expand Down

0 comments on commit a1caf19

Please sign in to comment.