hello again
I need to get a random record excluding some values using must_not directive.
this is the query i've created using some online post.
{
"index": "articles",
"body":
{
"size": 1,
"query":
{
"function_score":
{
"query":
{
"must_not": [
{
"term":
{
"language.keyword": "en_US"
}
},
{
"term":
{
"language.keyword": "es_ES"
}
}]
},
"functions": [
{
"random_score": {}
}]
}
}
}
}
but doesn't work.
"reason": "[must_not] query malformed, no start_object after query name",
without the
'query' => [ 'must_not' => ... ],
work perfectly.
any idea?