我正在嘗試根據(jù)多個術(shù)語進行過濾。如果我指定一個術(shù)語,我可以過濾[ "bool" => [ "must" => [ 0 => [ "term" => [ "interests" => [ "value" => "art" ] ] ] ] ]]但是當(dāng)我使用多個術(shù)語時,我總是得到一個空的回應(yīng)。[ "bool" => [ "must" => [ 0 => [ "term" => [ "interests" => [ "value" => "art" ] ] ] 1 => [ "term" => [ "community_privacy" => [ "value" => "private" ] ] ] ] ]]我是否誤解了我應(yīng)該如何使用多個術(shù)語?
1 回答

侃侃爾雅
TA貢獻1801條經(jīng)驗 獲得超16個贊
php 語法對我來說是新的,但是在數(shù)組中的 JSON 中,您需要將每個 term(s) 子句包裝在它自己的bool和must/ filter/ etc 中。所以在 JSON 中它會是這樣的:
{"query":{
"bool":{
"must":[
{"bool":{
"must":{
"term":{
"interests" : "art"
}
}
}
},
{"bool":{
"must":{
"term":{
"community_privacy": "private"
}
}
}
}
]
}
}
}
- 1 回答
- 0 關(guān)注
- 123 瀏覽
添加回答
舉報
0/150
提交
取消