# Fetch only matching result fields from Search query

**URL:** https://discuss.elastic.co/t/fetch-only-matching-result-fields-from-search-query/102265
**Category:** Elasticsearch
**Created:** [September 29, 2017, 1:44pm UTC](https://discuss.elastic.co/t/fetch-only-matching-result-fields-from-search-query/102265 "2017-09-29T13:44:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Paddy\_Mahadeva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paddy_mahadeva/32/44225_2.png) [@Paddy\_Mahadeva](https://discuss.elastic.co/u/Paddy_Mahadeva)
#### Post date: [September 29, 2017, 1:44pm UTC](https://discuss.elastic.co/t/fetch-only-matching-result-fields-from-search-query/102265/1 "2017-09-29T13:44:03Z")

</div>

Hi,

I have a document with many text fields. I am running a search query on these fields using the below query

```
{
  "query": {
    "multi_match": {
      "query": "abc",
      "fields": ["UserName", "Company", "Email", "Phone"],
      "type" : "phrase_prefix"
    }
  }
}

```

which works well,

but I get the response in \_source with the the whole data mapped to their keys, where as I need them in an array as comma seperated values, and also of only matching strings. How can I achieve the same?

Thanks  
Paddy

---

<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: [October 27, 2017, 1:44pm UTC](https://discuss.elastic.co/t/fetch-only-matching-result-fields-from-search-query/102265/2 "2017-10-27T13:44:50Z")

</div>

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