# How to do a match\_phrase query on all searchable fields instead of on a single field?

**URL:** <https://discuss.elastic.co/t/how-to-do-a-match-phrase-query-on-all-searchable-fields-instead-of-on-a-single-field/243760>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-graph\
**Created:** [August 4, 2020, 5:51pm UTC](https://discuss.elastic.co/t/how-to-do-a-match-phrase-query-on-all-searchable-fields-instead-of-on-a-single-field/243760 "2020-08-04T17:51:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mruthyu](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mruthyu](https://discuss.elastic.co/u/mruthyu)\
**Post date:** [August 4, 2020, 5:51pm UTC](https://discuss.elastic.co/t/how-to-do-a-match-phrase-query-on-all-searchable-fields-instead-of-on-a-single-field/243760/1 "2020-08-04T17:51:50Z")

</div>

How to do a match\_phrase query on all searchable fields instead of on a single field?  
I do see in the documentation as mentioned below where search can be done on only specific field.

GET /\_search  
{  
"query": {  
"match\_phrase": {  
"message": "this is a test"  
}  
}  
}  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html)

Thanks,  
M'Jay

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [August 4, 2020, 8:13pm UTC](https://discuss.elastic.co/t/how-to-do-a-match-phrase-query-on-all-searchable-fields-instead-of-on-a-single-field/243760/2 "2020-08-04T20:13:45Z")

</div>

"match" and "match\_phrase" query work on a single field.  
If you want to use multiple fields with a phrase, you need to use [multi\_match](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html) query with `type`: `phrase`:

```auto
{
  "query": {
    "multi_match": {
      "query": "this is a test",
      "fields": ["*"],
      "type" : "phrase"
    }
  }
}

```

---

<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:** [September 1, 2020, 8:13pm UTC](https://discuss.elastic.co/t/how-to-do-a-match-phrase-query-on-all-searchable-fields-instead-of-on-a-single-field/243760/3 "2020-09-01T20:13:54Z")

</div>

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