如何生成这样的查询?
select * from topic where field1 = "abc" and field2 = "xyz"
我已尝试过以下操作,但无法获得正确的语法:
curl -X POST "localhost:9200/topic/_search" -H 'Content-Type: application/json' -d'
{
"query": {
"terms" : {
"field1": "abc",
"field2": "xyz"
}
}
}
'
答案 0 :(得分:1)
怎么样......
db.collection("matches")
.whereGreaterThanOrEqualTo("date",openDate.getTime())
.whereLessThanOrEqualTo("date",closeDate.getTime())
Terms Query没有做你想要的。相反,它会在同一个键中搜索不同的值。