File tree Expand file tree Collapse file tree 1 file changed +5
-17
lines changed
x-pack/plugins/ingest_manager/server/services/epm/kibana/index_pattern Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -372,12 +372,11 @@ export const ensureDefaultIndices = async (callCluster: CallESAsCurrentUser) =>
372372 Promise . all (
373373 Object . keys ( IndexPatternType ) . map ( async indexPattern => {
374374 const defaultIndexPatternName = indexPattern + INDEX_PATTERN_PLACEHOLDER_SUFFIX ;
375- const indexExists = await doesIndexExist ( defaultIndexPatternName , callCluster ) ;
375+ const indexExists = await callCluster ( 'indices.exists' , { index : defaultIndexPatternName } ) ;
376376 if ( ! indexExists ) {
377377 try {
378- await callCluster ( 'transport.request' , {
379- method : 'PUT' ,
380- path : `/${ defaultIndexPatternName } ` ,
378+ await callCluster ( 'indices.create' , {
379+ index : defaultIndexPatternName ,
381380 body : {
382381 mappings : {
383382 properties : {
@@ -387,20 +386,9 @@ export const ensureDefaultIndices = async (callCluster: CallESAsCurrentUser) =>
387386 } ,
388387 } ) ;
389388 } catch ( putErr ) {
390- throw new Error ( `${ defaultIndexPatternName } could not be created` ) ;
389+ // throw new Error(`${defaultIndexPatternName} could not be created`);
390+ throw new Error ( putErr ) ;
391391 }
392392 }
393393 } )
394394 ) ;
395-
396- export const doesIndexExist = async ( indexName : string , callCluster : CallESAsCurrentUser ) => {
397- try {
398- await callCluster ( 'transport.request' , {
399- method : 'HEAD' ,
400- path : indexName ,
401- } ) ;
402- return true ;
403- } catch ( err ) {
404- return false ;
405- }
406- } ;
You can’t perform that action at this time.
0 commit comments