I'm struggling to get my head around a certain use-case that I'm trying to
code up at the moment.
Essentially, I am trying to assign an auto incrementing value to a document
based on it's sort order within Elasticsearch. I'm doing this as I have a
rankings system where ranks are generated dynamically, based upon the
search criteria given by the user, and so these ranks cannot be
predetermined (they HAVE to be calculated by Elasticsearch at runtime).
I have worked out how to calculate and sort the ranks for each document,
using the "avg" sort mode option when sorting. The part I'm having
difficulty with is assigning an arbitrary number to each document to
signify it's position in the resultset, based on rank. I need this to be
returned in the resultset for each document so that I'm able to display
this rank, regardless of how the final result set is sorted.
For example, given the following documents....
data: [1, 2, 3, 4]
data: [4, 5, 6, 7]
data: [10, 11, 12, 13]
After running the query and ordering by "name asc", I want to get the
result set: (assuming that a lower rank number is "better")
data: [10, 11, 12, 13],
data: [1, 2, 3, 4],
data: [4, 5, 6, 7],
So my question is.... what kind of search request would I need to make in
order to generate this "rank" number?
Thanks for reading!
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 firstname.lastname@example.org.
For more options, visit https://groups.google.com/groups/opt_out.