Python - How to upload jsonl file to Elasticsearch

So I'm trying to learn how to use Elasticsearch but I'm really struggling. I've tried looking at the official documentation but it's really not helping me.

Basically what I'm trying to do is upload a jsonl file that has approximately 10,000 entries. I've tried uploading them by splitting the entries up and then doing

elasticsearch.index(index=index_name, body=data)

but I'm not entirely sure if it's working correctly.

This is a snippet of 2 entries from the jsonl file that I'm trying to upload to Elasticsearch.

{"id":"a080f99a-07d9-47d1-8244-26a540017b7a","content":"KUALA LUMPUR, Sept 15 (MySinchew) -- The Kuala Lumpur City Hall today issued an ultimatum to Bersih 2.0 to pay the clean-up bill by this month or face legal action.\n\nDeputy federal territories minister Datuk Loga Bala Mohan Jaganathan said the bill amounting to RM61,840 includes the monitoring cost and cleaning of banners and graffiti as well as repair of damaged infrastructure.\n\nHe said DBKL would bring this matter to the court if Bersih 2.0 failed to pay up.","title":"Pay up or face legal action: DBKL","media-type":"News","source":"My Sinchew","published":"2015-09-15T10:17:53Z"}

{"id":"3c5636e8-06b7-43fd-8a80-0e8535f45cb2","content":"Mumbai, Sep 11 : Following were the indicative currency notes\u00a0 and travellers\u2019 cheques buying and selling rates per unit\u00a0 today.\u00a0 CURRENCY NAME BUY SALE UAE DIRHAM 16.7276 19.1652 AUSTRALIAN DOLLAR 43.7311 49.3792\u00a0 BANGLADESH TAKA 0.782276 0.921413\u00a0 BAHRAIN DINAR 163.3139 186.6076 CANADIAN DOLLAR 46.2854 53.1733\u00a0 SWISS FRANC 63.3832 72.8305 CHINESE YUAN 7.36 11.96 DANISH KRONE 9.1253 10.6636 EURO 69.8139 79.004\u00a0 STERLING POUND 95.581 108.1744 HONG KONG DOLLAR 7.7277 9.2278\u00a0 JAPANESE YEN 0.5098 0.5795 KUWAITI DINAR 181.7544 225.9568\u00a0\u00a0 SRI LANKA RUPEE 0.4387 0.5162 MALAYSIAN RINGITT 13.6713 16.8179 NORWEGIAN KRONE 7.3399 8.6565 NEPALESE RUPEE 0.5749 0.6251 NEW ZEALAND DOLLAR 38.0173 44.6709 OMANI RIAL 160.016414 182.547573 PAKISTAN RUPEE 0.5835 0.6864 QATARI RIAL 16.8627 19.3201 SAUDI RIAL 16.3564 18.9515 SWEDISH KRONA 7.1261 8.4018 SINGAPORE DOLLAR 42.9001 50.6758 THAI BAHT 1.6894 2.0027 US DOLLAR 61.8807 70.0204 SOUTH AFRICAN RAND 4.2193 5.1954","title":"Euro up; USD, Pound and Yen down","media-type":"News","source":"","published":"2015-09-11T06:09:32Z"}

Also, once I've uploaded the file to Elasticsearch, what would be the best way to double-check the file has been successfully uploaded?

Thanks for any help you can provide

Welcome to our community! :smiley:

Use the _cat/indices?v API to see what indexes exist in your cluster, you should see one that matches your index_name. You should also be logging in your app?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.