json - How to post bulk to elastic search using python? -
i have post information elastic search using python. info looks like
{ "index": {"_type": "testsuitereport","_index": "testsuite"}}{"driver name": "","run mode": "","testsuite_starttime": "2016-10-0t14:20:09","testsuite link": "2016-10-20t14:20:09","number of tests passed": 491}
i using curl posting data search server using command
curl -i -x put -k "http://serverip:5601/_bulk" --data-binary @filelocation.
can me finding alternative way implement in python ?
read json data file. use requests python library post json server
import requests data = open('yourfile').read() url = "http://serverip:5601/_bulk" requests.post(url, data=data)
Comments
Post a Comment