# Most elegant way to -OR- two phrase queries together

**URL:** <https://discuss.elastic.co/t/most-elegant-way-to-or-two-phrase-queries-together/8816>\
**Category:** Elasticsearch\
**Created:** [August 22, 2012, 4:59pm UTC](https://discuss.elastic.co/t/most-elegant-way-to-or-two-phrase-queries-together/8816 "2012-08-22T16:59:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_P](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@Josh\_P](https://discuss.elastic.co/u/Josh_P)\
**Post date:** [August 22, 2012, 4:59pm UTC](https://discuss.elastic.co/t/most-elegant-way-to-or-two-phrase-queries-together/8816/1 "2012-08-22T16:59:05Z")

</div>

I have a schema with a single field named "keywords\_search" whose value is  
an array of phrases. I would like to perform a the most efficient possible  
search\_type=count query that returns all documents whose keyword\_search  
field contains either phrase "ford mustang" or "ford f150", ideally with  
caching. I don't need any ranking/scoring. Here's the query I've come up  
with so far:

{  
"query": {  
"constant\_score": {  
"filter": {  
"or": [{  
"query": {  
"text\_phrase": {  
"keywords\_search": "ford mustang"  
}  
}  
}, {  
"query": {  
"text\_phrase": {  
"keywords\_search": "ford f150"  
}  
}  
}  
]  
}  
}  
}  
}

Is there a more concise query to achieve this? I'm currently using the  
default tokenizer/analyzer, but I can change that if necessary. Here's a  
sample matching document:

{  
"keywords\_search": ["I want a ford mustang", "who let the dogs out"]  
}

Thanks!

--

---

<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, 3:15am UTC](https://discuss.elastic.co/t/most-elegant-way-to-or-two-phrase-queries-together/8816/2 "2017-07-06T03:15:28Z")

</div>

Closed on July 6, 2017, 3:15am UTC


