Created
July 30, 2014 19:55
-
-
Save ishara/97651e9199bbed038bb2 to your computer and use it in GitHub Desktop.
Elasticsearch query with groovy script
This file contains hidden or 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
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