Я пытаюсь следовать этому ответу , но я получаю ошибку в параметре действий массового метода. Я могу использовать next
для генерации массива json объектов, но когда я передаю его helpers.bulk
, я получаю ошибку.
Это мой код:
from elasticsearch import Elasticsearch, helpers
import sys, json
import os
es = Elasticsearch("localhost:9200")
filename = "path_to_file.json"
def load_json(filename):
# " Use a generator, no need to load all in memory"
print(filename)
with open(filename,'r') as open_file:
yield json.load(open_file)`
helpers.bulk(es, load_json(filename), index='cllimaster_test', doc_type='clli_data_test')
Ошибка :
