is it possible to have aggregations with a random order? It seems that there is only asc or desc possible?
{
\"aggs\" : {
\"genders\" : {
\"terms\" :
Yes you can show random results
refer to the answer provided here:
Random order & pagination Elasticsearch
You can try something like this. I wanted to randomize the results inside buckets so I have used it.
{
"aggs": {
"genders": {
"terms": {
"field": "gender"
},
"aggs": {
"search_second": {
"top_hits": {
"sort": {
"_script": {
"script": "Math.random()",
"type": "number",
"params": {},
"order": "asc"
}
}
}
}
}
}
}
}