Skip to content

Instantly share code, notes, and snippets.

@luizgpsantos
Created September 12, 2014 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizgpsantos/a1ca8b87b70ae4c2cf5c to your computer and use it in GitHub Desktop.
Save luizgpsantos/a1ca8b87b70ae4c2cf5c to your computer and use it in GitHub Desktop.
Simulate timeout
from elasticsearch import Elasticsearch
es = Elasticsearch(hosts=[{"host": "localhost", "port": 9200}])
print es.search(body={
"query": {
"function_score": {
"query": {
"match_all": {}
},
"functions": [
{
"script_score": {
"script": "if(sleep(30))1 else 2",
"lang": "groovy"
}
}
]
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment