How to send a text file to elasticsearch with rest api

I have a log file which I want to send to elasticsearch.



The problem is:

  1. If I use filebeat, it will treat every line as a document. Of course, I could set some multiline regular expression, but here no special rules I could give because file contents are different from files to files.

  2. Then, I tried to send the whole contents of files to elasticsearch like next:

     curl -XPUT 'localhost:9200/text/article/2' -H 'Content-Type: application/json' -d '

My question is, do we have some command which could directly send a text file's contents to elasticsearch? Or any sdk could help me?

Have a look at FSCrawler project. This might help you.

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