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
]