简体   繁体   中英

How to use Elasticsearch bulk index with single JSON file in Python

I have a single JSON file formatted like:

    {"index":{"_type": "summary", "_id": "0001-1200-2015-12-31-0007", "_index": "transaction"}}
    {"data_load_user_id": "nathan", "tender_time": 5, "ring_time": 8, "operator_id": "0111"}

for about 12,000 rows. As far as I know, this is the correct way to format a JSON file for the bulk API in elasticsearch. I'm still confused on how to use es.bulk() with this single file as input. I already have the index and id specified for each row.

好的,所以helpers.bulk()模块将字典列表和我的helpers.bulk()客户端作为参数,而不是每个条目JSON文件排2行,我只需要添加"_index" "type""_id"每一个JSON字典,它的工作!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM