Skip to content

Instantly share code, notes, and snippets.

@fosstrack
fosstrack / elasticsearch.custom.sort.py
Last active November 21, 2016 18:20 — forked from darklow/elasticsearch.custom.sort.py
Updated script to avoid org.elasticsearch.index.mapper.Uid.idFromUid which no longer works. Cast the doc['id'].value as needed to enable array look up. This is based on a comment by the original author elsewhere.
q = {
"query": {
"function_score": {
"boost_mode": "replace",
"query": {
"ids": {
"values": [
50,
80,
44,