# How to do AND search

**URL:** <https://discuss.elastic.co/t/how-to-do-and-search/237112>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [June 15, 2020, 10:28am UTC](https://discuss.elastic.co/t/how-to-do-and-search/237112 "2020-06-15T10:28:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sawan\_Mehta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sawan_mehta/32/45032_2.png) [@Sawan\_Mehta](https://discuss.elastic.co/u/Sawan_Mehta)\
**Post date:** [June 15, 2020, 10:28am UTC](https://discuss.elastic.co/t/how-to-do-and-search/237112/1 "2020-06-15T10:28:13Z")

</div>

Assuming a user searches for  
"red shirts for men" and there are no results for  
color:red product:shirt and gender:men

It should show no results. Where as it shows results for  
color:red product:shirt

How to solve this issue?

I cant add to all keywords as user might add some other words as well

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [June 17, 2020, 3:21pm UTC](https://discuss.elastic.co/t/how-to-do-and-search/237112/2 "2020-06-17T15:21:45Z")

</div>

You would have to do some expansion to the user's query before passing it along to App Search.

If the users typed: "red shirts for men" you could expand it to use [Lucene query syntax](https://swiftype.com/documentation/app-search/api/search#lucene), so something like:  
"red AND shirts AND men".

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [June 17, 2020, 3:24pm UTC](https://discuss.elastic.co/t/how-to-do-and-search/237112/3 "2020-06-17T15:24:10Z")

</div>

However, I wouldn't necessarily recommend doing that. I would recommend just showing all results, and providing facets for a user to refine / filter their search results by color, product, and gender, etc.

---

<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 15, 2020, 3:24pm UTC](https://discuss.elastic.co/t/how-to-do-and-search/237112/4 "2020-07-15T15:24:10Z")

</div>

Closed on July 15, 2020, 3:24pm UTC

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