[英]ElasticSearch NEST - FieldValueFactorFunction score function outputting invalid json query
Let me preface this to say I'm newer to ElasticSearch and NEST, and may be doing something wrong.让我先说我是 ElasticSearch 和 NEST 的新手,可能做错了什么。 This is using NEST 7.6.2.
这是使用 NEST 7.6.2。
I'm following the documentation to create a field_value_factor
score function containing a filter and weight using object initializer syntax, ie:我正在按照文档使用 object 初始化语法创建包含过滤器和权重的
field_value_factor
分数 function,即:
new FieldValueFactorFunction
{
Field = "foo",
Modifier = FieldValueFactorModifier.Log1P,
Missing = 1,
Filter = new MatchQuery
{
Field = "bar",
Query = "1"
},
Weight = .2
}
However, at runtime it appears to output an invalid json format in the query itself:但是,在运行时,查询本身中的 output 似乎是无效的 json 格式:
{
"filter": {
"match": {
"bar": {
"query": "1"
}
}
},
"field_value_factor": {
"field": "foo",
"missing": 1.0,
"modifier": "log1p",
"filter": {
"match": {
"bar": {
"query": "1"
}
}
},
"weight": 0.2
},
"weight": 0.2
}
Which fails with the error field_value_factor query does not support [value]
.失败并出现错误
field_value_factor query does not support [value]
。 I do know the valid function syntax I'm trying to emulate is the following:我确实知道我试图模拟的有效 function 语法如下:
{
"filter": {
"match": {
"bar": {
"query": "1"
}
}
},
"field_value_factor": {
"field": "foo",
"missing": 1.0,
"modifier": "log1p"
},
"weight": 0.2
}
Is this a bug in NEST/Elasticsearch.net?这是 NEST/Elasticsearch.net 中的错误吗? Is my syntax incorrect?
我的语法不正确吗? Is there an alternate way to do what I'm trying to do?
有没有其他方法可以做我想做的事情?
This was apparently an issue in the version of NEST I was using.这显然是我使用的 NEST 版本中的一个问题。 Updating the nuget package resolved it.
更新 nuget package 解决了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.