# AND and OR queries

**URL:** <https://discuss.elastic.co/t/and-and-or-queries/12850>\
**Category:** Elasticsearch\
**Created:** [July 18, 2013, 8:03pm UTC](https://discuss.elastic.co/t/and-and-or-queries/12850 "2013-07-18T20:03:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrian\_M](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adrian\_M](https://discuss.elastic.co/u/Adrian_M)\
**Post date:** [July 18, 2013, 8:03pm UTC](https://discuss.elastic.co/t/and-and-or-queries/12850/1 "2013-07-18T20:03:52Z")

</div>

Hi  
I've noticed something strange when I do queries on ES cluster.

Basically my entire query is a string like this: headlights OR headlamp

So the JSON would look sth like this:  
"query\_string" : {  
"query" : "headlights OR headlamp",  
"default\_field" : "post.body"  
}  
}

Now the confusing part:  
1: If I search for headlights I get 10 results.  
2: If I search for headlamp I get 9 results.  
3: When I search for headlights OR headlamp I get 4 results. The results  
contain 2 results for headlights and 2 results for headlamp.  
_Shouldn't this return 10+9 results? Why not?_  
4: If I search for for headlights OR headlamp I get only 1 result. This is  
correct since there is one results with both these words.

Thanks  
Adrian

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Adrian\_M](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adrian\_M](https://discuss.elastic.co/u/Adrian_M)\
**Post date:** [July 18, 2013, 8:17pm UTC](https://discuss.elastic.co/t/and-and-or-queries/12850/2 "2013-07-18T20:17:29Z")

</div>

#4 is supposed to be AND not OR:

4: If I search for headlights AND headlamp I get only 1 result. This is  
correct since there is one results with both these words.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:25am UTC](https://discuss.elastic.co/t/and-and-or-queries/12850/3 "2017-07-06T02:25:38Z")

</div>


