import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey' ; import type { ListArraySchema } from '@kbn/securitysolution-io-ts-list-types' ; import { encodeHitVersion } from '@kbn/securitysolution-es-utils' ; import { SearchEsListSchema } from '../../schemas/elastic_response' ; export interface TransformElasticToListOptions { response : estypes . SearchResponse < SearchEsListSchema > ; } export const transformElasticToList = ( { response , } ) : ListArraySchema => { return response . hits . hits . map ( ( hit ) => { return { _version : encodeHitVersion ( hit ) , id : hit . _id , ... hit . _source , } ; } ) ; } ;