# Input Elasticsearch Query in logstash

**URL:** <https://discuss.elastic.co/t/input-elasticsearch-query-in-logstash/50229>\
**Category:** Logstash\
**Created:** [May 17, 2016, 2:46pm UTC](https://discuss.elastic.co/t/input-elasticsearch-query-in-logstash/50229 "2016-05-17T14:46:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![billy6](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@billy6](https://discuss.elastic.co/u/billy6)\
**Post date:** [May 17, 2016, 2:46pm UTC](https://discuss.elastic.co/t/input-elasticsearch-query-in-logstash/50229/1 "2016-05-17T14:46:27Z")

</div>

Hello! I would like to use a query filtering these parameters in logstash's elasticsearch input\>

host.raw = host 1 OR host 2  
&  
code != "123"

How could I do the query? I have been trying several things for a while without success  
ES version is 1.7.1

input{  
elasticsearch {  
host=\>  
query =\> '{ "query": .... }'

---

<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:** [May 17, 2016, 2:54pm UTC](https://discuss.elastic.co/t/input-elasticsearch-query-in-logstash/50229/2 "2016-05-17T14:54:47Z")

</div>

The queries need to be in this style - [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/query-dsl.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/query-dsl.html)

---

<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:** [July 6, 2017, 4:57am UTC](https://discuss.elastic.co/t/input-elasticsearch-query-in-logstash/50229/3 "2017-07-06T04:57:24Z")

</div>


