import * as TaskEither from 'fp-ts/lib/TaskEither' ; import * as Either from 'fp-ts/lib/Either' ; import { IndexMapping } from '../../mappings' ; import { ElasticsearchClient } from '../../../elasticsearch' ; import { catchRetryableEsClientErrors , RetryableEsClientError , } from './catch_retryable_es_client_errors' ; export type FetchIndexResponse = Record < string , { aliases : Record < string , unknown > ; mappings : IndexMapping ; settings : unknown ; } > ; internal export interface FetchIndicesParams { client : ElasticsearchClient ; indices : string [ ] ; } /**
 * Fetches information about the given indices including aliases, mappings and
 * settings.
 */ export const fetchIndices = ( { client , indices , } ) : TaskEither . TaskEither < RetryableEsClientError , FetchIndexResponse > => ( ) => { return client . indices . get ( { index : indices , ignore_unavailable : true , } , { ignore : [ 404 ] , maxRetries : 0 } ) . then ( ( { body } ) => { return Either . right ( body ) ; } ) . catch ( catchRetryableEsClientErrors ) ; } ;