Ran into an issue where I needed to use a script sort with Elastic Search. Needs to be used in combination with the elasticsearch_connector patch #3076173: Allow Script Based Sorting

Comments

lukedekker created an issue. See original summary.

lukedekker’s picture

Issue summary: View changes
lukedekker’s picture

StatusFileSize
new2.34 KB

Alternate patch that assumes the value is an array and that the scores are integers instead of strings.

lukedekker’s picture

StatusFileSize
new2.14 KB

And I reworked this again because it sucked... Now the script is passed in as a parameter.

drunken monkey’s picture

Component: General code » Framework
Category: Task » Feature request
Status: Needs work » Closed (won't fix)

As this is obviously specific to one backend, we won’t add support for this to the Search API.
Instead, simply pass a special value (like ':script') to the existing sort() method and any additional data you need via a query option. Then, the ES backend can just look for that. No need to add specific support for it.
If you want to make this available for other modules as well, you could consider formally defining this as a backend feature.