# How to query 2 fields in the input section

**URL:** <https://discuss.elastic.co/t/how-to-query-2-fields-in-the-input-section/63775>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [October 24, 2016, 5:01pm UTC](https://discuss.elastic.co/t/how-to-query-2-fields-in-the-input-section/63775 "2016-10-24T17:01:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryang97](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@ryang97](https://discuss.elastic.co/u/ryang97)\
**Post date:** [October 24, 2016, 5:01pm UTC](https://discuss.elastic.co/t/how-to-query-2-fields-in-the-input-section/63775/1 "2016-10-24T17:01:38Z")

</div>

Hi,

I am curious about is it possible to query 2 fields at the same time? If it is possible, how?

the first field i want to match is "response: 500"  
the second field is a timestamp range

I tried something like

"input" : {  
"http" : {  
"request" : {  
"host" : "localhost",  
"port" : 9200,  
"path" : "'/filebeat-2016.10.20/\_search?pretty'",  
"body" : "{  
"query" : {  
"and" : [  
{  
"range": {  
"@timestamp" : {  
"from": "2016-10-20T23:58:00.000Z",  
"to": "2016-10-20T23:59:00.000Z"  
}  
}  
},  
{  
"match" : { "response" : "500"}  
}  
]  
}  
}"  
}  
}  
},

but failed

thanks for any help

---

<div class="post-metadata">

**Author:** ![ryang97](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@ryang97](https://discuss.elastic.co/u/ryang97)\
**Post date:** [October 24, 2016, 5:50pm UTC](https://discuss.elastic.co/t/how-to-query-2-fields-in-the-input-section/63775/2 "2016-10-24T17:50:24Z")

</div>

problem solved, just type the query part in one line

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 25, 2016, 7:24am UTC](https://discuss.elastic.co/t/how-to-query-2-fields-in-the-input-section/63775/3 "2016-10-25T07:24:22Z")

</div>

I f you dont want to escape all that JSON, but write it as regular JSON, you can use the [search input](https://www.elastic.co/guide/en/watcher/2.4/input.html#input-search) instead of the HTTP one - might be less error prone.

---

<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, 1:42pm UTC](https://discuss.elastic.co/t/how-to-query-2-fields-in-the-input-section/63775/4 "2017-07-06T13:42:19Z")

</div>


