这是我的搜索过滤器查询, 我想给出条款的“和”条件。 现在我已经在过滤条件中给出了必须
'query' => [
"filtered" => [
"query" => [
"match_all" => []
],
"filter" => [
"bool" => [
"must" => [
"terms" => [
"num" => [
1,2,3
]
],
"terms" => [
"sample" => [
"a", "b"
],
]
]
]
],
'query' => [
'multi_match' => [
'query' => "Hello",
'fields' => ['text'],
'operator' => 'and'
],
]
]
],
但它不起作用。还有其他解决办法吗?
答案 0 :(得分:1)
尝试这一点,当你想添加'和'condtion时,只需在bool中添加该部分即可。
{"query":{"bool":{"must":[{"terms":{"num":[1,2,3]}},{"terms":{"sample":["a","b"]}},{"match":{"text":"hello"}}]}},"from":0,"size":10}
答案 1 :(得分:0)
您需要将Snackbar.make()
个过滤器放在另一个数组中,否则您的terms
会变成一个关联数组,而这不是您想要的(即bool/must
过滤器中的一个被丢弃)
terms