您好我有弹性搜索的查询,我想转换为NEST,所以我可以用c#
"query": {
"constant_score" : {
"filter" : {
"bool" : {
"must" : [
{ "term" : { "Week.keyword": "1712" } },
{ "term" : { "CountAsFailure.keyword": "TRUE" } },
{ "term" : { "Weekday.keyword": "1" } }
]
}
}
}
}
答案 0 :(得分:0)
您可以尝试:
Query(q => q.ConstantScore(cs => cs.Filter(
f => f.Bool(b => b.Must(m => m.Term("Week.keyword", "1712") &&
m.Term("CountAsFailure.keyword", "TRUE") &&
m.Term("Weekday.keyword", "1"))))))
或者:
Query(q => q.ConstantScore(cs => cs.Filter(
f => f.Term("Week.keyword", "1712") &&
f.Term("CountAsFailure.keyword", "TRUE") &&
f.Term("Weekday.keyword", "1"))))
类似的方法对我有用。我是从https://discuss.elastic.co/t/convert-dsl-query-to-nest-net/93527/4
找到的