I'm trying to add a feature to my search where I can exclude users that contain certain hashtags from the result .
My code for including users that contain all of the given hashtags works, and is the same as the code below except it uses 'must' instead of 'must_not'.
When I change 'must' to 'must_not', it appears to have no effect whatsoever, instead of the intended effect of excluding users that contain those hashtags. I'm not sure what else to try or if I misunderstood the purpose of must_not.
I'm using ES 6.8 in PHP.
foreach ($this->hashtags as $hashtag) {
$query[] = [
'nested' => [
'path' => 'hashtags',
'query' => [
'bool' => [
'must_not' => [
[
'match' => [
'hashtags.hashtagId' => $hashtag
]
]
]
]
]
]
];
}
Thanks