# Running an exact phrase match against all fields under multiple indexes in ElasticSearch

**URL:** <https://discuss.elastic.co/t/running-an-exact-phrase-match-against-all-fields-under-multiple-indexes-in-elasticsearch/35242>\
**Category:** Elasticsearch\
**Created:** [November 22, 2015, 11:01am UTC](https://discuss.elastic.co/t/running-an-exact-phrase-match-against-all-fields-under-multiple-indexes-in-elasticsearch/35242 "2015-11-22T11:01:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shivang\_Sarawagi](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Shivang\_Sarawagi](https://discuss.elastic.co/u/Shivang_Sarawagi)\
**Post date:** [November 22, 2015, 11:01am UTC](https://discuss.elastic.co/t/running-an-exact-phrase-match-against-all-fields-under-multiple-indexes-in-elasticsearch/35242/1 "2015-11-22T11:01:38Z")

</div>

I need to run an exact phrase match against all the fields under multiple indices.

The elastic java api has a method matchPhaseQuery

/\*\*  
\* Creates a text query with type "PHRASE" for the provided field name and text.  
\*  
\* @param name The field name.  
\* @param text The query text (to be analyzed).  
\*/  
public static MatchQueryBuilder matchPhraseQuery(String name, Object text) {  
return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.PHRASE);  
}  
The problem is it requires the field names to run a match phrase query against. Whereas I need to run against all the fields under multiple indices.

Is there any way to achieve this?

---

<div class="post-metadata">

**Author:** ![Maarten\_Roosendaal](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@Maarten\_Roosendaal](https://discuss.elastic.co/u/Maarten_Roosendaal)\
**Post date:** [November 22, 2015, 12:30pm UTC](https://discuss.elastic.co/t/running-an-exact-phrase-match-against-all-fields-under-multiple-indexes-in-elasticsearch/35242/2 "2015-11-22T12:30:53Z")

</div>

Hi,

Use MultiMatch:  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html)

Regards,  
Maarten

---

<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, 11:36pm UTC](https://discuss.elastic.co/t/running-an-exact-phrase-match-against-all-fields-under-multiple-indexes-in-elasticsearch/35242/3 "2017-07-05T23:36:43Z")

</div>


