Last active
January 23, 2018 06:59
-
-
Save devrimbaris/4544310f50ca2df406d6aeeb4f57176c to your computer and use it in GitHub Desktop.
[elasticsearch] scripted field query
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
{ | |
"sort" : [ | |
{"processing_end_time" : {"order" :"asc"}} | |
], | |
"query": { | |
"bool" : { | |
"must" :{ | |
"range":{ | |
"processing_end_time": { | |
"gte": "now-1d/d" | |
} | |
} | |
}, | |
"must" : { | |
"script" : { | |
"script" : { | |
"inline": "doc['processing_end_time'].value - doc['ingestion_time'].value > 6000", | |
"lang": "painless" | |
} | |
} | |
} | |
} | |
}, | |
"script_fields": { | |
"scores": { | |
"script": { | |
"inline": "(doc['processing_end_time'].value - doc['ingestion_time'].value)/1000", | |
"lang": "painless" | |
} | |
} | |
}, | |
"_source" : ["vin", "gpt", "ingestion_time","processing_end_time"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment