# How to express SQL in Logstash

**URL:** https://discuss.elastic.co/t/how-to-express-sql-in-logstash/255049
**Category:** Logstash
**Created:** [November 11, 2020, 11:29am UTC](https://discuss.elastic.co/t/how-to-express-sql-in-logstash/255049 "2020-11-11T11:29:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)
#### Post date: [November 11, 2020, 11:29am UTC](https://discuss.elastic.co/t/how-to-express-sql-in-logstash/255049/1 "2020-11-11T11:29:14Z")

</div>

Hello Team

I am using Logstash and Elasticsearch version 7.8.0.

I want to write query in logstash for input plugin of elasticsearch as

```auto
select userId from myindex

```

I am unable to achieve same in logstash ...

---

<div class="post-metadata">

### Author: ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)
#### Post date: [November 13, 2020, 8:08am UTC](https://discuss.elastic.co/t/how-to-express-sql-in-logstash/255049/2 "2020-11-13T08:08:13Z")

</div>

Hi,

I don't think this is possible as the elasticsearch input takes the query as an ElasticSearch DSL document.

However, there are a few possibilities that you could try:

1. If you have a platinum or enterprise license you are allowed to use the [ElasticSearch JDBC](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/sql-jdbc.html) agent. in this case, you could use the [jdbc-input](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html) plugin to do the query.
2. The second option is the Elasticsearch [SQL API](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest-overview.html). You could utilize this API using the [http\_poller](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-http_poller.html) plugin.

Best regards  
Wolfram

---

<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: [December 11, 2020, 8:08am UTC](https://discuss.elastic.co/t/how-to-express-sql-in-logstash/255049/3 "2020-12-11T08:08:25Z")

</div>

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