Reputation: 2202
$params = [
"size" => 5000,
'index' => 'my_post',
'type' => 'my_post',
'body' => [
'query' => [
'bool' => [
'should' => [
[
'match' => ['poststatus_id' => 'public']
],
[
"bool" => [
"must" => [
"match" => [
'poststatus_id' => 'only_me',
],
"match" => [
'creator.user_id' => $user
]
]
]
],
],
]
]
]
];
its my elastic search query i Need another or condition that is poststatus_id = "followers" and creator.user_id in (1,2,3,4) anyone tell me how can i write this query
Upvotes: 1
Views: 48
Reputation: 2202
$params = [
"size" => 5000,
'index' => 'my_post',
'type' => 'my_post',
'body' => [
'query' => [
'bool' => [
'should' => [
[
'match' => ['poststatus_id' => 'public']
],
[
"bool" => [
"must" => [
"match" => [
'poststatus_id' => 'only_me',
],
"match" => [
'creator.user_id' => $user
]
]
]
],
[
"bool" => [
"must" => [
[
"match" => [
"poststatus_id" => "followers"
]
],
[
"terms" => [
"creator.user_id" => [1,2,3,4]
]
]
]
]
]
],
]
],
]
];
Upvotes: 0
Reputation: 5987
Try this..
$params = [
"size" => 5000,
'index' => 'my_post',
'type' => 'my_post',
'body' => [
'query' => [
'bool' => [
'should' => [
[
'match' => ['poststatus_id' => 'public']
],
[
"bool" => [
"must" => [
[
"match" => [
'poststatus_id' => 'only_me',
]
],
[
"match" => [
'creator.user_id' => $user
]
]
]
]
],
[
"bool" => [
"must" => [
[
"match" => [
"poststatus_id" => "followers"
]
],
[
"terms" => [
"poststatus_id" => [1,2,3,4]
]
]
]
]
]
]
]
]
]
];
Upvotes: 1