Elasticsearch - NEST - Elasticsearch.NET - 搜索后过滤

时间:2016-06-24 09:46:26

标签: c# .net elasticsearch filter nest

我问自己,是否可以使用我自己的方法从我的C#代码中过滤SearchResponse的结果。这样我就可以粘贴一个过滤结果集的Action?

var desc = new SearchDescriptor<T>();
desc.Query(q => SomeSearch);
var searchResponse = Client.Search<T>(desc);
var filteredData = searchResponse.Documents.Any() ? Filter(searchResponse.Documents, options.SenderXid) : searchResponse.Documents;

1 个答案:

答案 0 :(得分:0)

我认为你可以这样做:

var searchResponse = Client.Search<T>(desc);
var postFilteredData = searchResponse.Hits.Where(x=>x.Date > something);

这是你想要做的吗?