Last active
August 12, 2017 06:44
-
-
Save ken57/f85f3952ddf2844da11b355771273446 to your computer and use it in GitHub Desktop.
スクリプトソート確認クエリ
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 -XGET "http://localhost:9200/blog/_search?pretty" -d '{ | |
"query" : { | |
"function_score" : { | |
"query":{ | |
"match": { | |
"title": "aaa" | |
} | |
}, | |
"boost_mode": "replace", | |
"script_score" : { | |
"script" : "_score/1.56 * -0.60051519 + doc[\"favoriteCount\"].value/100.0 * 0.90340906 + doc[\"viewCount\"].value/1000.0 * 1.3645355" | |
} | |
} | |
} | |
}' | |
{ | |
"took": 9, | |
"timed_out": false, | |
"_shards": { | |
"total": 1, | |
"successful": 1, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 3, | |
"max_score": -0.24598959, | |
"hits": [ | |
{ | |
"_index": "blog", | |
"_type": "item", | |
"_id": "3", | |
"_score": -0.24598959, | |
"_source": { | |
"title": "aaa aaa bbb bbb yyy", | |
"favoriteCount": 0, | |
"viewCount": 200 | |
} | |
}, | |
{ | |
"_index": "blog", | |
"_type": "item", | |
"_id": "1", | |
"_score": -0.30170023, | |
"_source": { | |
"title": "aaa bbb ccc", | |
"favoriteCount": 10, | |
"viewCount": 20 | |
} | |
}, | |
{ | |
"_index": "blog", | |
"_type": "item", | |
"_id": "2", | |
"_score": -0.39288783, | |
"_source": { | |
"title": "ccc aaa", | |
"favoriteCount": 10, | |
"viewCount": 30 | |
} | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment