from elasticsearch import helpers, Elasticsearch
data = [{'id':1, 'content':'some content'}]
INDEX_NAME = 'index'
TYPE = 'list'
def get_actions():
actions = []
for d in data:
action = {
'_op_type': 'update',
"_index": INDEX_NAME,
'_type': TYPE,
"_id": d['id'],
}
actions.append(action)
return(actions)
result = helpers.bulk(Elasticsearch(IP), get_actions())