[英]Import data into Elastic Search using Logstash in Python
I have imported a JSON file into ElasticSearch index using the command line for logstash. 我已经使用logstash的命令行将JSON文件导入到ElasticSearch索引中。 I used the following command: 我使用以下命令:
.\\logstash -f logstash.conf 。\\ logstash -f logstash.conf
The path of the file to be imported has been provided in the logstash.conf file. logstash.conf文件中提供了要导入文件的路径。 I have been able to achieve this using command line. 我已经能够使用命令行来实现这一点。
But how do i do the same thing in python? 但是我如何在python中做同样的事情呢? Aim is to import bulk data into elasticsearch index using python (with or without logstash) 目的是使用python(带或不带logstash)将批量数据导入Elasticsearch索引
You can use bulk loader http://elasticsearch-py.readthedocs.io/en/master/helpers.html?highlight=bulk#bulk-helpers 您可以使用批量加载程序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 如果您无法将文件放入内存中,请使用流式传输选项http://elasticsearch-py.readthedocs.io/en/master/helpers.html?highlight=bulk#elasticsearch.helpers.streaming_bulk
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.