@@ -6,7 +6,6 @@ import createMappingsFromPatternFields from '../../../lib/create_mappings_from_p
6
6
import initDefaultFieldProps from '../../../lib/init_default_field_props' ;
7
7
import { ingestToPattern , patternToIngest } from '../../../../common/lib/convert_pattern_and_ingest_name' ;
8
8
import { keysToCamelCaseShallow } from '../../../../common/lib/case_conversion' ;
9
- import ingestPipelineApiKibanaToEsConverter from '../../../lib/converters/ingest_pipeline_api_kibana_to_es_converter' ;
10
9
11
10
export function registerPost ( server ) {
12
11
const kibanaIndex = server . config ( ) . get ( 'kibana.index' ) ;
@@ -25,7 +24,7 @@ export function registerPost(server) {
25
24
} ,
26
25
( patternDeletionError ) => {
27
26
throw new Error (
28
- `index-pattern ${ indexPatternId } created successfully but index template or pipeline
27
+ `index-pattern ${ indexPatternId } created successfully but index template
29
28
creation failed. Failed to rollback index-pattern creation, must delete manually.
30
29
${ patternDeletionError . toString ( ) }
31
30
${ rootError . toString ( ) } `
@@ -34,27 +33,6 @@ export function registerPost(server) {
34
33
) ;
35
34
}
36
35
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
-
58
36
server . route ( {
59
37
path : '/api/kibana/ingest' ,
60
38
method : 'POST' ,
@@ -71,7 +49,6 @@ export function registerPost(server) {
71
49
const indexPattern = keysToCamelCaseShallow ( requestDocument . index_pattern ) ;
72
50
const indexPatternId = indexPattern . id ;
73
51
const ingestConfigName = patternToIngest ( indexPatternId ) ;
74
- const shouldCreatePipeline = ! _ . isEmpty ( requestDocument . pipeline ) ;
75
52
delete indexPattern . id ;
76
53
77
54
const mappings = createMappingsFromPatternFields ( indexPattern . fields ) ;
@@ -81,8 +58,6 @@ export function registerPost(server) {
81
58
indexPattern . fields = JSON . stringify ( indexPattern . fields ) ;
82
59
indexPattern . fieldFormatMap = JSON . stringify ( indexPattern . fieldFormatMap ) ;
83
60
84
- const pipeline = ingestPipelineApiKibanaToEsConverter ( requestDocument . pipeline ) ;
85
-
86
61
// Set up call with request params
87
62
const patternCreateParams = {
88
63
index : kibanaIndex ,
@@ -105,13 +80,6 @@ export function registerPost(server) {
105
80
}
106
81
} ;
107
82
108
- const pipelineParams = {
109
- path : `/_ingest/pipeline/${ ingestConfigName } ` ,
110
- method : 'PUT' ,
111
- body : pipeline
112
- } ;
113
-
114
-
115
83
return boundCallWithRequest ( 'indices.exists' , { index : indexPatternId } )
116
84
. then ( ( matchingIndices ) => {
117
85
if ( matchingIndices ) {
@@ -122,15 +90,6 @@ export function registerPost(server) {
122
90
. then ( ( ) => {
123
91
return boundCallWithRequest ( 'indices.putTemplate' , templateParams )
124
92
. 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 ) ; } ) ;
134
93
} ) ;
135
94
} )
136
95
. then (
0 commit comments