Reputation: 1309
I'm trying to filter based on multiple terms. I am able to filter if I designate one term
[
"bool" => [
"must" => [
0 => [
"term" => [
"interests" => [
"value" => "art"
]
]
]
]
]
]
But when I use multiple terms I'm always getting an empty response.
[
"bool" => [
"must" => [
0 => [
"term" => [
"interests" => [
"value" => "art"
]
]
]
1 => [
"term" => [
"community_privacy" => [
"value" => "private"
]
]
]
]
]
]
Am I misunderstanding how I should be using multiple terms?
Upvotes: 2
Views: 150
Reputation: 411
The php syntax is new for me, but in JSON in an array you need to wrap every term(s) clause in its own bool
and must
/filter
/ etc . So in JSON it would be like this:
{"query":{
"bool":{
"must":[
{"bool":{
"must":{
"term":{
"interests" : "art"
}
}
}
},
{"bool":{
"must":{
"term":{
"community_privacy": "private"
}
}
}
}
]
}
}
}
Upvotes: 1