I'm using NEST and Elasticsearch.Net versions 1.9.2. I'm trying to create a FieldValueFactor scoring function which all seems to work properly except I can't figure out how to specify the field I want to use.
I'd like to just specify a string literal here of the field I want to use as the value factor field just like I've done when I create the query DSL by hand. However, there isn't an overload for that. The only .Field() API takes:
Expression<Func<object, object>>
Even if I created an expression tree, what should it look like? All I want to do is indicate that I want, say, the value in the "kumquat" field used as the factor. Again, it's easy to do when crafting the query DSL by hand so I'm confused by this API.
Thank you very much Russ! I will (ab)use the .Suffix() extension method. We have our upgrade all mapped out but due to our significant reliance on ES, I estimate the work at a couple of sprints for a couple of engineers so we haven't taken that effort forward yet. I really appreciate your assistance with this workaround, I'm getting the expected query DSL and results now.
There are quite a few changes in the API from 1.x to 2.x that not only reflect changes in the Elasticsearch APIs, but also to make the naming of methods and types in the client consistent with Elasticsearch's API e.g. .Field(...) instead of .OnField(...). The majority of the changes in 2.x to 5.x reflect changes in the Elasticsearch API.
Fantastic, thanks for the resource pointers, I really appreciate that! Yes, I've run into a few of the API inconsistencies e.g. .TermsLookup() and I'm looking forward to getting to upgrade, just not sure when it's going to happen.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.