Skip to content

Instantly share code, notes, and snippets.

@ishara
Created July 30, 2014 19:55
Show Gist options
  • Save ishara/97651e9199bbed038bb2 to your computer and use it in GitHub Desktop.
Save ishara/97651e9199bbed038bb2 to your computer and use it in GitHub Desktop.
Elasticsearch query with groovy script
GET /my_data/data_type/_search
{
"query": {
"function_score": {
"query": {
"range": {
"yearopened": {
"gte": 2000
}
}
},
"functions": [
{
"script_score": {
"lang": "groovy",
"script": "_score * doc['yearopened'].value.toInteger()"
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment