/// <summary> /// 搜索 /// </summary> /// <typeparam name="TResult">结果类型</typeparam> /// <param name="context">服务</param> /// <param name="query">查询参数</param> public static EsSearch <TResult> Search <TResult>(this IElasticsearchContext context, IQueryParameter query) where TResult : class { context.CheckNull(nameof(context)); query.CheckNull(nameof(query)); return(new EsSearch <TResult>(context, query)); }
public EsSearch(IElasticsearchContext context, IQueryParameter query) { context.CheckNull(nameof(context)); query.CheckNull(nameof(query)); _context = context; _queryParam = query; _sorts = new List <ISort>(); _includeFields = new List <Field>(); _excludeFields = new List <Field>(); _query = new EsQuery <TResult>(); }