I have imported a JSON file into ElasticSearch index using the command line for logstash. I used the following command:
.\\logstash -f logstash.conf
The path of the file to be imported has been provided in the logstash.conf file. I have been able to achieve this using command line.
But how do i do the same thing in python? Aim is to import bulk data into elasticsearch index using python (with or without logstash)
You can use bulk loader http://elasticsearch-py.readthedocs.io/en/master/helpers.html?highlight=bulk#bulk-helpers
in case you're not able to fit your file in memory - use streaming option http://elasticsearch-py.readthedocs.io/en/master/helpers.html?highlight=bulk#elasticsearch.helpers.streaming_bulk
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.