Created
August 5, 2014 17:56
-
-
Save penguinco/c72369f6604979d65de6 to your computer and use it in GitHub Desktop.
function score query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -o result.json 'http://localhost:9200/ldgourmet/restaurant/_search?pretty=true' -d ' | |
{ | |
"query" : { | |
"function_score" : { | |
"query" : { | |
"simple_query_string" : { | |
"query": "ハンバーガー", | |
"fields": ["name", "name_kana", "address"], | |
"default_operator": "and" | |
} | |
}, | |
"score_mode": "sum", | |
"boost_mode": "replace", | |
"functions" : [ | |
{ | |
"filter" : { "range" : { "access_count" : { "from" : 500 }}}, | |
"boost_factor" : 10 | |
}, | |
{ | |
"filter" : { "range" : { "photo_count" : { "from" : 3 }}}, | |
"boost_factor" : 10 | |
}, | |
{ | |
"filter" : { "geo_distance" : { "distance" : "2km", "location" : [139.43 , 35.38] }}, | |
"boost_factor" : 100 | |
} | |
] | |
} | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ここで書いたことの抜粋です。
http://code46.hatenablog.com/entry/2014/01/21/115620
より詳しくは: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html