22 lines
436 B
C#
22 lines
436 B
C#
using Nest;
|
|
using SJZY.Expand.ElasticSearch;
|
|
|
|
namespace SJZY.Track.Repository;
|
|
|
|
public static class EsExtensions
|
|
{
|
|
public static List<T> ToIdList<T>(this ISearchResponse<T> response) where T : IdBaseIndex
|
|
{
|
|
var dtos = new List<T>();
|
|
|
|
foreach (var hit in response.Hits)
|
|
{
|
|
var dto = hit.Source;
|
|
dto.Id = hit.Id;
|
|
|
|
dtos.Add(dto);
|
|
}
|
|
|
|
return dtos;
|
|
}
|
|
} |