@@ -6,7 +6,6 @@ import createMappingsFromPatternFields from '../../../lib/create_mappings_from_p
66import initDefaultFieldProps from '../../../lib/init_default_field_props' ;
77import { ingestToPattern , patternToIngest } from '../../../../common/lib/convert_pattern_and_ingest_name' ;
88import { keysToCamelCaseShallow } from '../../../../common/lib/case_conversion' ;
9- import ingestPipelineApiKibanaToEsConverter from '../../../lib/converters/ingest_pipeline_api_kibana_to_es_converter' ;
109
1110export function registerPost ( server ) {
1211 const kibanaIndex = server . config ( ) . get ( 'kibana.index' ) ;
@@ -25,7 +24,7 @@ export function registerPost(server) {
2524 } ,
2625 ( patternDeletionError ) => {
2726 throw new Error (
28- `index-pattern ${ indexPatternId } created successfully but index template or pipeline
27+ `index-pattern ${ indexPatternId } created successfully but index template
2928 creation failed. Failed to rollback index-pattern creation, must delete manually.
3029 ${ patternDeletionError . toString ( ) }
3130 ${ rootError . toString ( ) } `
@@ -34,27 +33,6 @@ export function registerPost(server) {
3433 ) ;
3534 }
3635
37- function templateRollback ( rootError , templateName , boundCallWithRequest ) {
38- const deleteParams = {
39- name : templateName
40- } ;
41-
42- return boundCallWithRequest ( 'indices.deleteTemplate' , deleteParams )
43- . then (
44- ( ) => {
45- throw rootError ;
46- } ,
47- ( templateDeletionError ) => {
48- throw new Error (
49- `index template ${ templateName } created successfully but pipeline
50- creation failed. Failed to rollback template creation, must delete manually.
51- ${ templateDeletionError . toString ( ) }
52- ${ rootError . toString ( ) } `
53- ) ;
54- }
55- ) ;
56- }
57-
5836 server . route ( {
5937 path : '/api/kibana/ingest' ,
6038 method : 'POST' ,
@@ -71,7 +49,6 @@ export function registerPost(server) {
7149 const indexPattern = keysToCamelCaseShallow ( requestDocument . index_pattern ) ;
7250 const indexPatternId = indexPattern . id ;
7351 const ingestConfigName = patternToIngest ( indexPatternId ) ;
74- const shouldCreatePipeline = ! _ . isEmpty ( requestDocument . pipeline ) ;
7552 delete indexPattern . id ;
7653
7754 const mappings = createMappingsFromPatternFields ( indexPattern . fields ) ;
@@ -81,8 +58,6 @@ export function registerPost(server) {
8158 indexPattern . fields = JSON . stringify ( indexPattern . fields ) ;
8259 indexPattern . fieldFormatMap = JSON . stringify ( indexPattern . fieldFormatMap ) ;
8360
84- const pipeline = ingestPipelineApiKibanaToEsConverter ( requestDocument . pipeline ) ;
85-
8661 // Set up call with request params
8762 const patternCreateParams = {
8863 index : kibanaIndex ,
@@ -105,13 +80,6 @@ export function registerPost(server) {
10580 }
10681 } ;
10782
108- const pipelineParams = {
109- path : `/_ingest/pipeline/${ ingestConfigName } ` ,
110- method : 'PUT' ,
111- body : pipeline
112- } ;
113-
114-
11583 return boundCallWithRequest ( 'indices.exists' , { index : indexPatternId } )
11684 . then ( ( matchingIndices ) => {
11785 if ( matchingIndices ) {
@@ -122,15 +90,6 @@ export function registerPost(server) {
12290 . then ( ( ) => {
12391 return boundCallWithRequest ( 'indices.putTemplate' , templateParams )
12492 . catch ( ( templateError ) => { return patternRollback ( templateError , indexPatternId , boundCallWithRequest ) ; } ) ;
125- } )
126- . then ( ( templateResponse ) => {
127- if ( ! shouldCreatePipeline ) {
128- return templateResponse ;
129- }
130-
131- return boundCallWithRequest ( 'transport.request' , pipelineParams )
132- . catch ( ( pipelineError ) => { return templateRollback ( pipelineError , ingestConfigName , boundCallWithRequest ) ; } )
133- . catch ( ( templateRollbackError ) => { return patternRollback ( templateRollbackError , indexPatternId , boundCallWithRequest ) ; } ) ;
13493 } ) ;
13594 } )
13695 . then (
0 commit comments