Last active
June 15, 2016 12:29
-
-
Save zumo64/eef6184a190528a568581dbaf11f76b5 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
import os | |
import sys | |
import time | |
import json | |
from collections import defaultdict | |
from random import randint, choice | |
from datetime import datetime | |
startTime = datetime.now() | |
from elasticsearch import Elasticsearch, helpers | |
# cluster to run against | |
es = Elasticsearch('http://192.168.99.100:9200') | |
# returns avg size raw json | |
def scan(indexName,path): | |
with open(path, 'r') as m: | |
QRY = json.load(m) | |
helpers.scan(es, query=QRY, scroll=u'1m', raise_on_error=True,index=indexName,preserve_order=False, size=100) | |
#print "index = " + sys.argv[1] | |
indexName = sys.argv[1] | |
qryPath = sys.argv[2] | |
scan(indexName,qryPath) | |
print datetime.now() - startTime | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment