I would like to know whether it is possible to get results in subqueries in random order? There is a example query (example is in PHP array):
$params = [
'index' => 'users',
'type' => 'user',
'body' => [
'from' => $from,
'size' => $size,
'query' => [
'bool' => [
'must_not' => [
['ids' => [
'type' => 'user',
'values' => $ignoredIds
]]
],
'should' => [
['ids' => [
'type' => 'user',
'values' => [1, 2, 3, 4], // Preferred users
'boost' => 2000
]],
['match' => [
'verified' => [
'query' => '1',
'boost' => 10
]
]],
['match_all' => new \stdClass], // Then everybody else
],
]
]
]
];
Ideal result would be random order of "preferred users", but still keeping preferred user on top. Then verified users again, randomly sorted, bu after preferred and before the rest. And then randomly sorting the rest of users.
Is there any way?
Thanks for answers.
Aucun commentaire:
Enregistrer un commentaire