# Elasticsearch \_source include a specific array item from the document

**URL:** <https://discuss.elastic.co/t/elasticsearch-source-include-a-specific-array-item-from-the-document/105247>\
**Category:** Elasticsearch\
**Created:** [October 25, 2017, 1:11pm UTC](https://discuss.elastic.co/t/elasticsearch-source-include-a-specific-array-item-from-the-document/105247 "2017-10-25T13:11:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![singsuyash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/singsuyash/32/23397_2.png) [@singsuyash](https://discuss.elastic.co/u/singsuyash)\
**Post date:** [October 25, 2017, 1:11pm UTC](https://discuss.elastic.co/t/elasticsearch-source-include-a-specific-array-item-from-the-document/105247/1 "2017-10-25T13:11:34Z")

</div>

My document looks like this

```
{
            "_index": "mydb",
            "_type": "target",
            "_id": "AV8vO5O0eCTee14x6VZQ",
            "_score": 1,
            "_source": {
               "line": "77.001",
               "parameters": [
                  {
                     "parameterType": "Lift",
                     "coefficients": [
                        {
                           "name": "Margin"
                        },
                        {
                           "name": "Sales"
                        }
                     ]
                  },
                  {
                     "parameterType": "Display",
                     "coefficients": [
                        {
                           "name": "Front"
                        },
                        {
                           "name": "Back"
                        }
                     ]
                  }
               ]
            }
         }

```

In my search response i need to include one particular `coefficients` for a particular `parameterType`.  
For example i want `Margin` for `Lift` & `Back` for `Display`

**Question is how to i write my request?** Eventually i need to write it in NEST code.

request:

```
post mydb/target/_search
{
    "_source":{
        "include": [/*What should i write here?*/]
    }
}

```

response:

```
{
            "_index": "mydb",
            "_type": "target",
            "_id": "AV8vO5O0eCTee14x6VZQ",
            "_score": 1,
            "_source": {
               "line": "77.001",
               "parameters": [
                  {
                     "parameterType": "Lift",
                     "coefficients": [
                        {
                           "name": "Margin"
                        }
                     ]
                  },
                  {
                     "parameterType": "Display",
                     "coefficients": [
                        {
                           "name": "Back"
                        }
                     ]
                  }
               ]
            }
         }
```

---

<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:** [November 22, 2017, 1:11pm UTC](https://discuss.elastic.co/t/elasticsearch-source-include-a-specific-array-item-from-the-document/105247/2 "2017-11-22T13:11:49Z")

</div>

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