# Elasticsearch: fetching match\_phrase from a document in an index

**URL:** https://discuss.elastic.co/t/elasticsearch-fetching-match-phrase-from-a-document-in-an-index/136324
**Category:** Elasticsearch
**Created:** [June 18, 2018, 2:29pm UTC](https://discuss.elastic.co/t/elasticsearch-fetching-match-phrase-from-a-document-in-an-index/136324 "2018-06-18T14:29:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![elasticuser2](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@elasticuser2](https://discuss.elastic.co/u/elasticuser2)
#### Post date: [June 18, 2018, 2:29pm UTC](https://discuss.elastic.co/t/elasticsearch-fetching-match-phrase-from-a-document-in-an-index/136324/1 "2018-06-18T14:29:59Z")

</div>

Elasticsearch docs gives an example of how to build a search query with terms that can reside in a document and fetched from an index like below

```
GET /tweets/_search
{
    "query" : {
        "terms" : {
            "user" : {
                "index" : "users",
                "type" : "_doc",
                "id" : "2",
                "path" : "followers"
            }
        }
    }
}

```

Is it possible to do this with match\_phrase instead of terms? The below raises a parsing exception. What I am trying to do is to search a text field with a large number of phrase terms. Is it is not possible what is the best way to achieve its equivalent?

```
GET /tweets/_search
{
    "query" : {
        "match_phrase" : {
            "user" : {
                "index" : "users",
                "type" : "_doc",
                "id" : "2",
                "path" : "followers"
            }
        }
    }
}
```

---

<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 16, 2018, 2:30pm UTC](https://discuss.elastic.co/t/elasticsearch-fetching-match-phrase-from-a-document-in-an-index/136324/2 "2018-07-16T14:30:00Z")

</div>

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