我正在尝试进行提升查询,以降低名称为“type”且值为“Press”的字段的文档得分。
然而,NEST不会在生成的json对象的正字段中生成任何值:
"query": {
"boosting": {
"positive": {},
"negative": {
"term": {
"type": {
"value": "Press"
}
}
},
"negative_boost": 0.2
}
}
以下代码:
var result = _elasticClient.Search<SearchablePage>(new SearchDescriptor<SearchablePage>()
.Query(q => q
.Boosting(b => b
.NegativeBoost(0.2)
.Positive(p => p
.Filtered(fi => fi
.Filter(fq => fq
.Term(t => t.Type, aggregation)
)
.Query(qq => qq
.QueryString(qs => qs
.Query(query)
.OnFields(f => f.Name, f => f.Presentation, f => f.MainBody, f => f.SearchableBlocks.First().MainBody)
)
)
)
)
.Negative(n => n
.Term(f => f.OnField("type").Value("Press"))
)
)
));