view raw
Andrew Walters Andrew Walters - 5 months ago 66
C# Question

NEST deprecated field [include]

I just updated elastic search from 2.3.4 to 5.0.1, and nest C# nuget package to the latest 2.4.7

I have the following nest query:

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);

I'm getting the following error back from elastic:

Deprecated field [include] used, expected [includes] instead

Commenting out the
allows the query to run through.

Is there a different way to use


If you're running against Elasticsearch 5.0.1, you should use a 5.x version of NEST; the latest 5.x version on nuget is 5.0.0-rc3 (a prerelease) at this time, with 5.0.0 to come out very soon.

5.x contains the Includes property on ISourceFilter that Kulasangar highlights in his answer.