Search Nested documents

Hi All,
I saw lot of messages in the group about "parent/child" and "nested",
but am still unable to solve my issue.

I am holding nested type as shown here:
http://www.elasticsearch.org/guide/reference/query-dsl/nested-query.html
The main reason for this is to make some facets on the nested type
"type1.obj1".

Some times though I need to query only the nested type "type1.obj1"
and to extract it's _source. I tried with:
#curl -XGET http://localhost:9200/giftsplusindex/type1.obj/_search
but it didn't work.

Then I tried with the query bellow, but it still returns the type1
documents with all the type1.obj1 documents inside and not only obj1
documents:
#curl -XGET http://localhost:9200/giftsplusindex/type1/_search?pretty=true
-d '
{
"query": {
"nested": {
"path": "obj1",
"query": {
"match_all" : { }
}
}
},
"size": 10,
"from": 0
}'

I suppose this will work with "parent/child" but in this case I can
not make facets on the child I think?

I guess I am doing some design error.

You want to get just the nested document source? If so, you can't, you get back the full document you indexed back.

On Wednesday, February 22, 2012 at 1:56 PM, Ridvan Gyundogan wrote:

Hi All,
I saw lot of messages in the group about "parent/child" and "nested",
but am still unable to solve my issue.

I am holding nested type as shown here:
Elasticsearch Platform — Find real-time answers at scale | Elastic
The main reason for this is to make some facets on the nested type
"type1.obj1".

Some times though I need to query only the nested type "type1.obj1"
and to extract it's _source. I tried with:
#curl -XGET http://localhost:9200/giftsplusindex/type1.obj/_search
but it didn't work.

Then I tried with the query bellow, but it still returns the type1
documents with all the type1.obj1 documents inside and not only obj1
documents:
#curl -XGET http://localhost:9200/giftsplusindex/type1/_search?pretty=true
-d '
{
"query": {
"nested": {
"path": "obj1",
"query": {
"match_all" : { }
}
}
},
"size": 10,
"from": 0
}'

I suppose this will work with "parent/child" but in this case I can
not make facets on the child I think?

I guess I am doing some design error.