abdulsatharst
6/6/2017 - 8:48 AM

elasticbulk

elasticbulk

import json
from elasticsearch import Elasticsearch
from elasticsearch import helpers
es = Elasticsearch([{'host': 'localhost', 'port': 9200}])
with open("MOCK_DATA.json") as f:
 	js=json.load(f)
d=iter(js)
#print(next(d))
bulk=[]

def gen(js):
	for i in js:
		yield i
actions = [
  {
    "_index": "welcome",
    "_type":"hello",
    "_source":j

    
    
  }for  j in js
]