-
Couldn't load subscription status.
- Fork 1.2k
Closed
Labels
Description
I have the following code that is perfectly working with NEST 7, now I need to translate to the version 8 of the driver, but I was unable to find documentation. Can someone point me to the right direction?
string scale = Scale;
if (Scale.EndsWith('M'))
{
var days = Convert.ToInt32(Scale[..^1]) * 30;
scale = $"{days}d";
}
return new Nest.LinearDateDecayFunction
{
Field = OmniSearchItem.GetDateTimeDynamicPropertyName(BoostPropertyName),
Weight = Weight,
Origin = Nest.DateMath.Now,
Decay = Decay,
Scale = scale
};Actually I've tried this code but I was unable to set the weight parameter.
var ddf = new Elastic.Clients.Elasticsearch.QueryDsl.DateDecayFunction();
ddf.Field = OmniSearchItem.GetDateTimeDynamicPropertyName(BoostPropertyName);
ddf.Placement = new Elastic.Clients.Elasticsearch.QueryDsl.DecayPlacement<Elastic.Clients.Elasticsearch.DateMath, Elastic.Clients.Elasticsearch.Duration>();
ddf.Placement.Origin = Elastic.Clients.Elasticsearch.DateMath.Now;
ddf.Placement.Scale = scale;
ddf.Placement.Decay = Decay;