Christian
Christian

Reputation: 86

Decay functions in ElasticSearch using NEST

A similar question was asked here. However, I'm having trouble with the decay functions.

Why does this work ...

_client.Search<object>(s => s
    .Query(q => q
        .FunctionScore(fs => fs
            .Functions(f => f
                .ScriptScore(ss => ss.Script("1"))
                .Filter(ff => ff.Term("a", "b")))
            .BoostMode(FunctionBoostMode.sum))));

but this doesn't?

_client.Search<object>(s => s
    .Query(q => q
        .FunctionScore(fs => fs
            .Functions(f => f
                .Gauss(p => "someField", g => g.Origin("0").Offset("1"))
                .Filter(ff => ff.Term("a", "b")))
            .BoostMode(FunctionBoostMode.sum))));

Error: 'Nest.FunctionScoreFunction' does not contain a definition for 'Filter' and no extension method 'Filter' accepting a first argument of type 'Nest.FunctionScoreFunction' could be found (are you missing a using directive or an assembly reference?)

Also, I don't think the syntax on the first parameter of the Gauss function is correct (even when the filter is removed). Is there a good example of correct syntax for that function?

Upvotes: 0

Views: 655

Answers (1)

Christian
Christian

Reputation: 86

This was a bug in NEST, but has since been resolved with PR #799

Upvotes: 1

Related Questions