Nested type

Hi,

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

curl -XGET '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!

--

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' -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!

--