# How to make where-and-or clause statement in elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-to-make-where-and-or-clause-statement-in-elasticsearch/60832>\
**Category:** Elasticsearch\
**Created:** [September 19, 2016, 5:29am UTC](https://discuss.elastic.co/t/how-to-make-where-and-or-clause-statement-in-elasticsearch/60832 "2016-09-19T05:29:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gutasaputra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gutasaputra/32/10472_2.png) [@gutasaputra](https://discuss.elastic.co/u/gutasaputra)\
**Post date:** [September 19, 2016, 5:29am UTC](https://discuss.elastic.co/t/how-to-make-where-and-or-clause-statement-in-elasticsearch/60832/1 "2016-09-19T05:29:25Z")

</div>

im newbie in elasticsearch,  
i want to create a query to search document using multiple parameters.

when i use one parameter, its work.

 ![](https://us1.discourse-cdn.com/elastic/original/3X/c/f/cf7204e524a9bfe5324ace4c599a3d250df6d70c.png)  
but when i use where / or statement it goes wrong.  
 ![](https://us1.discourse-cdn.com/elastic/original/3X/e/b/ebd8dd37028f42a2a5ab717f2e25d4f7336ef6c3.png)  
what should i do?  
i want to make query like this :

> select \* from motorvehicle\_table where nama\_kendaraan = "toyota" and  
> tahun\_kendaraan = 2016 and tipe\_kendaraan = "Non-Truck"

many thanks return in advance.  
thank you.

---

<div class="post-metadata">

**Author:** ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)\
**Post date:** [September 19, 2016, 12:08pm UTC](https://discuss.elastic.co/t/how-to-make-where-and-or-clause-statement-in-elasticsearch/60832/2 "2016-09-19T12:08:14Z")

</div>

I think for the query you are describing you would be better served checking out the [Boolean Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html) to chain your constraints together.

As an aside: When making future posts, instead of posting screenshots consider posting pre-formatted text ([docs for syntax](https://help.disqus.com/customer/en/portal/articles/665057-syntax-highlighting)) instead, usually this is easier to read then having to scale images up and down.

Hope this helps,  
Isabel

---

<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 5, 2017, 10:19pm UTC](https://discuss.elastic.co/t/how-to-make-where-and-or-clause-statement-in-elasticsearch/60832/3 "2017-07-05T22:19:14Z")

</div>


