Is there any way to randomise the search hits every I rerun a query?
Due to the large number of hits, I just want to sample my results and do some statistical test on it. However, I have yet to find a way to randomise the search hits.
I read about function_score
, however it seem to return the same of set of hits every time I rerun the query. I tried with different seed_number
also, but there's no change after every rerun.
Here my code
"size": 1000,
"sort": [{"gc_transaction": "desc"}],
"query": {
"function_score": {
"query": {
"bool": {
"filter": {
"range": {
"@timestamp": {
"gte": "now-30d",
"lte": "now",
"format": "strict_date_optional_time"
}
}
},
"must": [
],
},
},
"random_score": {"seed": 3241325325},
"score_mode": "sum"
}
}