44 * you may not use this file except in compliance with the Elastic License.
55 */
66
7+ import { APICaller } from 'src/core/server' ;
78import { mlLog } from '../../client/log' ;
89
910import {
@@ -16,23 +17,31 @@ import {
1617// - ML_ANNOTATIONS_INDEX_PATTERN index is present
1718// - ML_ANNOTATIONS_INDEX_ALIAS_READ alias is present
1819// - ML_ANNOTATIONS_INDEX_ALIAS_WRITE alias is present
19- export async function isAnnotationsFeatureAvailable ( callAsCurrentUser ) {
20+ export async function isAnnotationsFeatureAvailable ( callAsCurrentUser : APICaller ) {
2021 try {
2122 const indexParams = { index : ML_ANNOTATIONS_INDEX_PATTERN } ;
2223
2324 const annotationsIndexExists = await callAsCurrentUser ( 'indices.exists' , indexParams ) ;
24- if ( ! annotationsIndexExists ) return false ;
25+ if ( ! annotationsIndexExists ) {
26+ return false ;
27+ }
2528
2629 const annotationsReadAliasExists = await callAsCurrentUser ( 'indices.existsAlias' , {
30+ index : ML_ANNOTATIONS_INDEX_ALIAS_READ ,
2731 name : ML_ANNOTATIONS_INDEX_ALIAS_READ ,
2832 } ) ;
2933
30- if ( ! annotationsReadAliasExists ) return false ;
34+ if ( ! annotationsReadAliasExists ) {
35+ return false ;
36+ }
3137
3238 const annotationsWriteAliasExists = await callAsCurrentUser ( 'indices.existsAlias' , {
39+ index : ML_ANNOTATIONS_INDEX_ALIAS_WRITE ,
3340 name : ML_ANNOTATIONS_INDEX_ALIAS_WRITE ,
3441 } ) ;
35- if ( ! annotationsWriteAliasExists ) return false ;
42+ if ( ! annotationsWriteAliasExists ) {
43+ return false ;
44+ }
3645 } catch ( err ) {
3746 mlLog . info ( 'Disabling ML annotations feature because the index/alias integrity check failed.' ) ;
3847 return false ;
0 commit comments