# Nested type

**URL:** <https://discuss.elastic.co/t/nested-type/10192>\
**Category:** Elasticsearch\
**Created:** [December 28, 2012, 12:31pm UTC](https://discuss.elastic.co/t/nested-type/10192 "2012-12-28T12:31:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_Ippolito](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_ippolito/32/2557_2.png) [@Nicolas\_Ippolito](https://discuss.elastic.co/u/Nicolas_Ippolito)\
**Post date:** [December 28, 2012, 12:31pm UTC](https://discuss.elastic.co/t/nested-type/10192/1 "2012-12-28T12:31:16Z")

</div>

Hi,

I search "foo" in a nested obj. with:

curl -XGET '[http://localhost:9200/horyou\_fr/member/\_search](http://localhost:9200/horyou_fr/member/_search)' -d '{  
"query": {  
"nested": {  
"path": "contents",  
"query": {  
"bool" : {  
"must" : [

{

```
                        "text" : {"contents.content" : "foo"}
                    }
                ]
            }
        }
    }
}

```

}'

The response is:

{

```
"took": 2,
"timed_out": false,
"_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
},
"hits": {
    "total": 1,
    "max_score": 2.098612,
    "hits": [
        {
            "_index": "horyou_fr",
            "_type": "member",
            "_id": "member-1",
            "_score": 2.098612,
            "_source": {
                "slug": "jacque-selere",
                "firstname": "Jacque",
                "lastname": "Selere",
                "__description": null,
                "stars": 0,
                "picture": 

```

"5a9a8f24d0131d2ef1f3a1eb75d82a4a/:format/default.jpg",  
"contents": [  
{  
"content": "foo"  
},  
{  
"content": "bar"  
}  
]  
}  
}  
]  
}  
}

Is it possible to remove "content": "bar" (which doesn't match my query)  
from the response?

Thanks!

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [December 31, 2012, 1:32pm UTC](https://discuss.elastic.co/t/nested-type/10192/2 "2012-12-31T13:32:23Z")

</div>

What you are getting in \_source is exactly what you indexed. Elasticsearch  
doesn't process source during retrieval. So, the best way to do it is to  
remove "bar" on the client side.

On Friday, December 28, 2012 7:31:16 AM UTC-5, Nicolas Ippolito wrote:

> Hi,
> 
> I search "foo" in a nested obj. with:
> 
> curl -XGET '[http://localhost:9200/horyou\_fr/member/\_search](http://localhost:9200/horyou_fr/member/_search)' -d '{  
> "query": {  
> "nested": {  
> "path": "contents",  
> "query": {  
> "bool" : {  
> "must" : [
> 
> {
> 
> ```
> "text" : {"contents.content" : "foo"}
> }
> ]
> }
> }
> }
> }
> 
> ```
> 
> }'
> 
> The response is:
> 
> {
> 
> ```
> "took": 2,
> "timed_out": false,
> "_shards": {
> "total": 5,
> "successful": 5,
> "failed": 0
> },
> "hits": {
> "total": 1,
> "max_score": 2.098612,
> "hits": [
> {
> "_index": "horyou_fr",
> "_type": "member",
> "_id": "member-1",
> "_score": 2.098612,
> "_source": {
> "slug": "jacque-selere",
> "firstname": "Jacque",
> "lastname": "Selere",
> "__description": null,
> "stars": 0,
> "picture": 
> 
> ```
> 
> "5a9a8f24d0131d2ef1f3a1eb75d82a4a/:format/default.jpg",  
> "contents": [  
> {  
> "content": "foo"  
> },  
> {  
> "content": "bar"  
> }  
> ]  
> }  
> }  
> ]  
> }  
> }
> 
> Is it possible to remove "content": "bar" (which doesn't match my query)  
> from the response?
> 
> Thanks!

--

---

<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 6, 2017, 2:58am UTC](https://discuss.elastic.co/t/nested-type/10192/3 "2017-07-06T02:58:08Z")

</div>


