public ElasticResult <T[]> GetAllByGuids <T>(string esType, params string[] guids) where T : class { if (guids.Length == 0) { return(ElasticResult <T[]> .SuccessResult(new T[] {})); } var multiGetDescriptor = new MultiGetDescriptor().GetMany <T>(guids).Index(_elasticRepository.EsIndex).Type(esType); var response = _elasticRepository.ExecuteMultiGetRequest(multiGetDescriptor); if (!response.Success) { return(ElasticResult <T[]> .FailResult(response.Message)); } var multiGetResponse = response.Response; var hits = multiGetResponse.GetMany <T>(guids); return(ElasticResult <T[]> .SuccessResult(hits.Select(hit => hit.Source).Where(hit => hit != null).ToArray())); }