# Curl in logstash conf

**URL:** <https://discuss.elastic.co/t/curl-in-logstash-conf/110457>\
**Category:** Logstash\
**Created:** [December 6, 2017, 5:29am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457 "2017-12-06T05:29:01Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shekhar\_Pandey](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shekhar\_Pandey](https://discuss.elastic.co/u/Shekhar_Pandey)\
**Post date:** [December 6, 2017, 5:29am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/1 "2017-12-06T05:29:01Z")

</div>

Can we use curl option in logstash conf...is this possible or not....

Thank you.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 6, 2017, 5:37am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/2 "2017-12-06T05:37:58Z")

</div>

You can, but why would you use that?  
There is `http_poller`, or metricbeat or other, better options.

---

<div class="post-metadata">

**Author:** ![Shekhar\_Pandey](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shekhar\_Pandey](https://discuss.elastic.co/u/Shekhar_Pandey)\
**Post date:** [December 6, 2017, 5:44am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/3 "2017-12-06T05:44:13Z")

</div>

Thanks for reply...Actually I want to use update\_by\_query API which Kibana code given below:  
POST sam/products/\_update\_by\_query  
{  
"query" : {  
"constant\_score" : {  
"filter" : {  
"term" : {  
"title" : "redmi note 4"  
}  
}  
}  
},  
"script" : {  
"lang":"painless",  
"source" : "ctx.\_source.frequency++"

}  
}

I dont know how to run through logstash conf....if you have any sample...it's will be very useful...Below is my logstash query conf...file but I dont know how to use update\_by\_query API..so I am thinking to use curl in logstash..

input {  
elasticsearch {  
hosts =\> "localhost:9200"  
index =\> "queryindex"  
query =\> '  
{  
"query" : {  
"term" : {  
"tags" : "solr"  
}  
}}'  
}  
}  
output {  
stdout{  
codec =\> rubydebug  
}  
csv {  
fields =\> ["id"]  
path =\> "/root/sam/csv-export1.csv"  
}  
}

Any suggestion you want to give ....

Thank you.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 6, 2017, 5:57am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/4 "2017-12-06T05:57:31Z")

</div>

So you want to take that query and then the update?

---

<div class="post-metadata">

**Author:** ![Shekhar\_Pandey](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shekhar\_Pandey](https://discuss.elastic.co/u/Shekhar_Pandey)\
**Post date:** [December 6, 2017, 6:01am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/5 "2017-12-06T06:01:35Z")

</div>

Yes warkolm.....but update\_by\_query is API and I don't know how to use in that logstash conf ....

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 6, 2017, 6:31am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/6 "2017-12-06T06:31:21Z")

</div>

The query in the input looks for solr, but the update is for phones though?

---

<div class="post-metadata">

**Author:** ![Shekhar\_Pandey](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shekhar\_Pandey](https://discuss.elastic.co/u/Shekhar_Pandey)\
**Post date:** [December 6, 2017, 6:35am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/7 "2017-12-06T06:35:15Z")

</div>

No ..actually I just show you my logstash query conf file....above query where I am doing with update\_by\_query I want to fix in logstash conf file....

---

<div class="post-metadata">

**Author:** ![Shekhar\_Pandey](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shekhar\_Pandey](https://discuss.elastic.co/u/Shekhar_Pandey)\
**Post date:** [December 6, 2017, 6:35am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/8 "2017-12-06T06:35:57Z")

</div>

This is below query with logstash..  
input {  
elasticsearch {  
hosts =\> "localhost:9200"  
index =\> "sam"  
query =\> '  
{  
"query" : {  
"constant\_score" : {  
"filter" : {  
"term" : {  
"title" : "redmi note 4"  
}  
}  
}  
},  
"script" : {  
"lang":"painless",  
"source" : "ctx.\_source.frequency++"

```
}

```

}'  
}  
}  
output {  
stdout{  
codec =\> json\_lines  
}  
elasticsearch {  
action =\> "\_update\_by\_query"  
hosts =\> ["localhost:9200"]  
index =\> "sam"  
document\_type =\> "products"

}  
}

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [December 6, 2017, 10:38am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/9 "2017-12-06T10:38:42Z")

</div>

Hi Shekhar,

I don't think you need to use the update by query option.

Please have a look at:

[https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-action](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-action)

Regards,  
N

---

<div class="post-metadata">

**Author:** ![Shekhar\_Pandey](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shekhar\_Pandey](https://discuss.elastic.co/u/Shekhar_Pandey)\
**Post date:** [December 6, 2017, 11:03am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/10 "2017-12-06T11:03:38Z")

</div>

Thanks NerdSec for reply. So I have to write python API...

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [December 7, 2017, 6:10am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/11 "2017-12-07T06:10:28Z")

</div>

Not required. Just use the elasticsearch output and mention the action as update instead of index.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 4, 2018, 6:10am UTC](https://discuss.elastic.co/t/curl-in-logstash-conf/110457/12 "2018-01-04T06:10:32Z")

</div>

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