Reputation: 1
Hi I have a query for elastic search, that I would like to convert to NEST, so I can use this with c#
"query": {
"constant_score" : {
"filter" : {
"bool" : {
"must" : [
{ "term" : { "Week.keyword": "1712" } },
{ "term" : { "CountAsFailure.keyword": "TRUE" } },
{ "term" : { "Weekday.keyword": "1" } }
]
}
}
}
}
Upvotes: 0
Views: 2063
Reputation: 31
You might try:
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"))))))
Or:
Query(q => q.ConstantScore(cs => cs.Filter(
f => f.Term("Week.keyword", "1712") &&
f.Term("CountAsFailure.keyword", "TRUE") &&
f.Term("Weekday.keyword", "1"))))
A similar approach worked for me. I found this from https://discuss.elastic.co/t/convert-dsl-query-to-nest-net/93527/4
Upvotes: 1