ArslanIqbal
ArslanIqbal

Reputation: 629

Elastic Search 5.5.2 with Nest 6.0 C#

I am using Nest 5.6.1 in my code with 5.5.2 Elastic Search. Due to a dependency of other packages, Nest needs to be updated to 6.0. When the Nest package is updated to 6.0, I am getting this error:

Method not found: 'Nest.SearchDescriptor1<!0> Nest.SearchDescriptor1.From(Int32)'.

Below is the query for fetching data from Elastic Search:

public ISearchResponse<ELCEntity> GetESData(ESDataModel metadata)
        {
            try
            {
                var container = GetElasticSearchQuery(metadata);
                return elasticReader.GetData(q => container, ESIndex);
            }
            catch(Exception ex)
            {
                throw;
            }

        }

        private QueryContainer GetElasticSearchQuery(ESDataModel metadata)
        {
            return queryBuilder
                .AddIfTrue(() => metadata.TypeIds?.Count > 0, q => q.Terms(t => t.Field("value.Type.Ids").Terms(metadata.TypeIds)))
                .AddIfTrue(() => true, q => q.Wildcard(field: new Field("value.SearchText"), value: "*", rewrite: MultiTermQueryRewrite.ConstantScore))
                .AddIfTrue(() => true, q => q.Wildcard(field: new Field("value.SearchTextTitle"), value: "*", rewrite: MultiTermQueryRewrite.ConstantScore))
                .Build();
        }

It is working fine with Nest 5.6.1. Is there a way to get it work with 6.0?

Thanks.

Upvotes: 0

Views: 19

Answers (0)

Related Questions