我刚刚将 flex 搜索从2.3.4更新为5.0.1,并将C#nuget包嵌套到最新的2.4.7
我有以下嵌套查询:
SourceFilter sourceFilter = new SourceFilter()
{
Include = Infer.Fields<Page>(p => p.Category, p => p.Title)
};
MultiMatchQuery multiMatchQuery = new MultiMatchQuery()
{
Fields = Infer.Fields<Page>(p => p.Title, p => p.MetaDescription, p => p.Keywords),
Type = TextQueryType.PhrasePrefix,
Query = search.Term
};
var searchQuery = new SearchRequest<Page>()
{
From = search.ResultsFrom,
Size = search.ResultsSize,
Source = sourceFilter,
Query = multiMatchQuery
};
var searchResponse = client.Search<Page>(searchQuery);
我从 flex 回来了以下错误:
Deprecated field [include] used, expected [includes] instead
注释掉
SourceFilter
允许查询通过。有使用
SourceFilter
的其他方法吗? 最佳答案
如果您针对Elasticsearch 5.0.1运行,请you should use a 5.x version of NEST; nuget上最新的5.x版本是5.0.0-rc3(预发行版),即将推出5.0.0。
5.x contains the Includes
property on ISourceFilter
即Kulasangar highlights in his answer。