From 747457f85cd67b96cea1ab234ef58895c87edaf2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20K=C3=B6gl?= Date: Fri, 18 Jul 2014 12:59:46 +0000 Subject: [PATCH] [Search] replace deprecated [function_score] Replaced by [custom_score] query; needs dynamic scripts enabled in the Elasticsearch configuration. --- mygpo/search/index.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mygpo/search/index.py b/mygpo/search/index.py index 1a91a777..67626bc1 100644 --- a/mygpo/search/index.py +++ b/mygpo/search/index.py @@ -53,11 +53,14 @@ def search_podcasts(query): conn = get_connection() q = { - "custom_score" : { + "function_score" : { + "boost_mode": 'replace', "query" : { 'query_string': {'query': query} }, - "script" : "_score * (doc.subscribers.doubleValue / 4000)" + "script_score" : { + 'script': "_score * (doc.subscribers.value / 4000)" + } } } results = conn.search(query=q, indices=settings.ELASTICSEARCH_INDEX, -- 2.11.4.GIT