2

Till now i have sent my data to Elasticsearch using either Filebeat or Logstash and sometimes both.

I just want to know whether there is any way of sending my data directly to Elasticsearch without using these two.

Sounds silly but i had to get my doubt cleared.

Saketh Bv
  • 21
  • 1
  • 7

2 Answers2

2

You communicate with Elasticsearch using its REST APIs, both Filebeat and Logstash use some REST API when sending data to elasticsearch.

For example, you can send data using a simple curl:

curl -X PUT "localhost:9200/twitter/_doc/1" -H 'Content-Type: application/json' -d'
{
    "user" : "kimchy",
    "post_date" : "2009-11-15T14:12:12",
    "message" : "trying out Elasticsearch"
}
'

For more information, read this documentation

leandrojmp
  • 7,082
  • 2
  • 19
  • 24
  • 1
    What if i have hundreds of lines of data, i guess we cant write it in curl. Am i right @leandrojmp. If yes, what will be the alternative way. – Saketh Bv May 06 '19 at 14:29
  • 1
    You can write a script or an app using any of the [clients](https://www.elastic.co/guide/en/elasticsearch/client/index.html), but why not use Filebeat or Logstash? – leandrojmp May 06 '19 at 16:04
  • @SakethBv you can curl a file by using the --data-binary flag. Here's a link to [an example](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html), Hundreds of lines should be no problem, but Elasticsearch does limit the size of the import - 100mb by default, but you can [change that setting if necessary](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html). – Joe Zack May 06 '19 at 22:48
  • @leandrojmp Im just checking if there is any other way, yeah i can use Filebeat or Logstash. – Saketh Bv May 07 '19 at 05:25
0

Instead of logstash you can use fluend. If you can tell about any constraint you have to using logstash/filebeat, then can suggest.