Skip to content

Instantly share code, notes, and snippets.

@codesnik
Created August 1, 2014 16:00
Show Gist options
  • Save codesnik/ae286221793af78ccecd to your computer and use it in GitHub Desktop.
Save codesnik/ae286221793af78ccecd to your computer and use it in GitHub Desktop.
{
"type": [
"alternative"
],
"index": "alternatives",
"body": {
"size": 10,
"_source": [
"id"
],
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"prop_4": "3"
}
},
{
"term": {
"prop_country_name": "israel"
}
}
]
}
},
"query": {
"function_score": {
"boost_mode": "replace",
"score_mode": "avg",
"functions": [
{
"script_score": {
"params": {
"cr": "cr_30"
},
"script": "doc[cr].value"
}
},
{
"script_score": {
"params": {
"cr": "cr_119"
},
"script": "doc[cr].value"
}
}
]
}
}
}
}
}
}
curl 'localhost:9200/alternatives/_search/?format=yaml&_source=0' -d '
{"query": {
"function_score": {
"functions": [
{ "script_score": { "script": "doc[cr].value", "params": { "cr": "cr_506" } } },
{ "script_score": { "script": "doc[cr].value", "params": { "cr": "cr_507" } } }
],
"score_mode": "avg",
"boost_mode": "replace"
}
}
}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment