# How can we achieve below query in elastic?

**URL:** <https://discuss.elastic.co/t/how-can-we-achieve-below-query-in-elastic/104923>\
**Category:** Elasticsearch\
**Created:** [October 23, 2017, 3:38pm UTC](https://discuss.elastic.co/t/how-can-we-achieve-below-query-in-elastic/104923 "2017-10-23T15:38:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![manikesh](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@manikesh](https://discuss.elastic.co/u/manikesh)\
**Post date:** [October 23, 2017, 3:38pm UTC](https://discuss.elastic.co/t/how-can-we-achieve-below-query-in-elastic/104923/1 "2017-10-23T15:38:09Z")

</div>

where name='manikesh' and age=35 and company='elastic'?

I know we did not have and operation supported in elastic but do we have it now? what other ways to achieve this?

---

<div class="post-metadata">

**Author:** ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)\
**Post date:** [October 23, 2017, 6:33pm UTC](https://discuss.elastic.co/t/how-can-we-achieve-below-query-in-elastic/104923/2 "2017-10-23T18:33:12Z")

</div>

Hi Manikesh,

You can use bool query with must option.

Take reference from  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html)

---

<div class="post-metadata">

**Author:** ![manikesh](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@manikesh](https://discuss.elastic.co/u/manikesh)\
**Post date:** [October 24, 2017, 7:14am UTC](https://discuss.elastic.co/t/how-can-we-achieve-below-query-in-elastic/104923/3 "2017-10-24T07:14:36Z")

</div>

Thanks .. just wanted to understand..when Lucene supports AND operation then why not elastic.. is there any specific reason..

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 24, 2017, 8:51am UTC](https://discuss.elastic.co/t/how-can-we-achieve-below-query-in-elastic/104923/4 "2017-10-24T08:51:20Z")

</div>

> [@manikesh](#):
>
> .when Lucene supports AND operation then why not elastic.

Lucene's query parser supports AND operator but under the covers this is translated into Lucene Bool query objects that use MUST. We reflect the Lucene core and not one (of several) query string syntaxes built on this core.

---

<div class="post-metadata">

**Author:** ![manikesh](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@manikesh](https://discuss.elastic.co/u/manikesh)\
**Post date:** [October 24, 2017, 10:31am UTC](https://discuss.elastic.co/t/how-can-we-achieve-below-query-in-elastic/104923/5 "2017-10-24T10:31:39Z")

</div>

This explains everything.. thanks much..

---

<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:** [November 21, 2017, 10:32am UTC](https://discuss.elastic.co/t/how-can-we-achieve-below-query-in-elastic/104923/6 "2017-11-21T10:32:13Z")

</div>

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