Skip to content

Instantly share code, notes, and snippets.

@penguinco
Created August 5, 2014 17:56
Show Gist options
  • Save penguinco/c72369f6604979d65de6 to your computer and use it in GitHub Desktop.
Save penguinco/c72369f6604979d65de6 to your computer and use it in GitHub Desktop.
function score query
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
}
]
}
}
}
'
@penguinco
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment