Created
October 14, 2014 07:27
-
-
Save brwe/5ba123604c4cc0af9c3a to your computer and use it in GitHub Desktop.
update script causing oom
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
import elasticsearch | |
es = elasticsearch.Elasticsearch() | |
for i in range(10000): | |
es.index(index="testidx", doc_type="doc", id=i, body= "{\"testfield\":\"a\"}") | |
es.indices.refresh() | |
for i in range(10000): | |
updateScript = "ctx._source.testfield += \" " + str(i) + "\"" | |
updatebody = {"script": updateScript, "lang": "groovy"} | |
es.update(index="testidx", doc_type="doc", id=i, body= updatebody) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment