I want to apply random sort based on bool query and want relevant results with random sorting. Here is the query
{
"query": {
"function_score": {
"random_score": {
"seed": 100,
"field": "_seq_no"
},
"query": {
"bool": {
"must": [
{
"term": {
"is_active": true
}
}
],
"should": [
{
"terms": {
"sentiment.keyword": [
"Negative",
"Sad"
]
}
},
{
"terms": {
"tag.keyword": [
"emotions",
"mental health",
"sadness"
]
}
}
]
}
}
}
}
}
I have tries using random_score but not sure is it helpful for me or not and anyone know usage of seed?
You can use function score query with
random_scoreoption.In case you want scores to be
reproducible, it is possible to provide aseedand field. - do you need that?