import { ElasticsearchClient } from 'kibana/server' ; import { getIndexState } from '../../common/get_index_state' ; import { ResolveIndexResponseFromES } from '../../common/types' ; type StatusCheckResult = Record < string , 'open' | 'closed' > ; export const esIndicesStateCheck = async ( asCurrentUser , indices ) : Promise < StatusCheckResult > => { const { body : response } = await asCurrentUser . indices . resolveIndex ( { name : '*' , expand_wildcards : 'all' , } ) ; const result = { } ; indices . forEach ( ( index ) => { result [ index ] = getIndexState ( index , response as ResolveIndexResponseFromES ) ; } ) ; return result ; } ;