简体   繁体   English

如何在 elasticsearch 中索引 csv 文档?

[英]How to index a csv document in elasticsearch?

I'm trying to upload some csv files in elastic search.我正在尝试在弹性搜索中上传一些 csv 文件。 I don't want to mess it up, so I'm writing for some guidance.我不想把它搞砸,所以我正在写一些指导。 Can someone help with a video/tutorial/documentation, of how to index a document in elastic search?有人可以提供有关如何在弹性搜索中索引文档的视频/教程/文档吗? I've read the official documentation, but I feel a bit lost as a begginer.我已经阅读了官方文档,但是作为初学者,我感到有些失落。 It will be fine If you'll recommend me a video tutorial, or you'll describe me some steps.如果您向我推荐一个视频教程,或者您将向我描述一些步骤,那就太好了。 Hope you are all doing well!希望你们一切都好! Thank you for your time !感谢您的时间 !

The best way is to use Logstash, which is official and very fast pipeline for elastic,you can download it from here最好的方法是使用 Logstash,它是官方的、非常快速的弹性管道,你可以从这里下载

First of all create a configuration file as below example and save it as logstashExample.conf in bin directory of logstash.首先创建如下示例的配置文件,并将其保存为logstash的bin目录下的logstashExample.conf。 With assuming that elastic server and kibana console are up and running, run the configuration file with this command "./logstash -f logstashExample.conf".假设弹性服务器和 kibana 控制台已启动并正在运行,请使用此命令“./logstash -f logstashExample.conf”运行配置文件。

I've also added a suitable example of related configuration file for Logstash, please change the index name in output and your file path in input with respect of your need, you can also disable filtering by removing csv components in below example.我还为 Logstash 添加了一个合适的相关配置文件示例,请根据需要更改 output 中的索引名称和输入中的文件路径,您也可以通过删除以下示例中的 csv 组件来禁用过滤。

 input { file { path => "/home/timo/bitcoin-data/*.csv" start_position => "beginning" sincedb_path => "/dev/null" } } filter { csv { separator => "," #Date,Open,High,Low,Close,Volume (BTC),Volume (Currency),Weighted Price columns => ["Date","Open","High","Low","Close","Volume (BTC)", "Volume (Currency)","Weighted Price"] } } output { elasticsearch { hosts => "http://localhost:9200" index => "bitcoin-prices" } stdout {} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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