Im trying to do a boosting query that reduces the score of documents where the field with name "type" and with the value "Press".
However NEST does not generate any values in the positive field in the generated json object:
"query": {
"boosting": {
"positive": {},
"negative": {
"term": {
"type": {
"value": "Press"
}
}
},
"negative_boost": 0.2
}
}
Code Below:
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"))
)
)
));
SearchablePage
and which version of NEST do you use? Looks like search from your example is correctly serialized on current develop branch of NEST. – Rob