Random sort with a seed changes after updating a doc


(Brandon Williams) #1

I'm using random_score to perform a search with some random sorting,
something as simple as this:

{
"fields": [
"id"
],
"query": {
"function_score": {
"random_score": {
"seed": 773372
}
}
},
"sort": [
{
"_score": "desc"
}
]
}

As soon as I update a doc in the index its position will change with this
sort. I took a diff of the before and after result set, and with a set of
about 180 documents I noticed 8 documents switched places after the update.

If I insert a doc instead of updating a doc then it works as expected. The
new doc is inserted into a random spot, but in a consistent manner.

Is this the expected behavior?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/91c6877b-fd70-4bbd-bad2-7fe0ab9643c6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Arny-2) #2

I'm facing the same issue.
Is there no way to choose what the seed actually should pick for the random
score calculation?
Or just let it pick the uid which never changes.

On Tuesday, February 11, 2014 1:00:57 AM UTC+1, Brandon Williams wrote:

I'm using random_score to perform a search with some random sorting,
something as simple as this:

{
"fields": [
"id"
],
"query": {
"function_score": {
"random_score": {
"seed": 773372
}
}
},
"sort": [
{
"_score": "desc"
}
]
}

As soon as I update a doc in the index its position will change with this
sort. I took a diff of the before and after result set, and with a set of
about 180 documents I noticed 8 documents switched places after the update.

If I insert a doc instead of updating a doc then it works as expected. The
new doc is inserted into a random spot, but in a consistent manner.

Is this the expected behavior?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/428e6570-93ca-4d46-940c-450dc4841b69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3