Facets on children

Hello,
Is there a way to create a facet on children when querying on parent? Is it
even makes sence?
I have this mapping:
{
"mappings" : {
"parentType" : {
"properties" : {
"id" : { "type" : "long"},
"price": { "type" : "double" }
}
},
"childType": {
"_parent": {"type": "parentType"},
"properties": {
"id": {"type": "long"},
"count": {"type":"long"}
}
}
}

}

I want to create a query like facet on nested element:
{
"query": {
"match_all":{}
},
"facets":{
"count_facet":{
"terms": {
"field": "count"
},
"nested": "childType"
}
}
}

Is there a way of achiving facets on the children?

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I think something like this will work.....

{
"facets": {
"count_facet": {
"terms": {
"field": "count"
},
"global": true,
"facet_filter": {
"has_parent": {
"query": {
"match_all": {}
},
"parent_type": "parentType"
}
}
}
},
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"type": {
"value": "parentType"
}
}
}
}
}

On Thu, Mar 28, 2013 at 7:06 AM, Udi Ben Amitai sabaudi@gmail.com wrote:

Hello,
Is there a way to create a facet on children when querying on parent? Is
it even makes sence?
I have this mapping:
{
"mappings" : {
"parentType" : {
"properties" : {
"id" : { "type" : "long"},
"price": { "type" : "double" }
}
},
"childType": {
"_parent": {"type": "parentType"},
"properties": {
"id": {"type": "long"},
"count": {"type":"long"}
}
}
}

}

I want to create a query like facet on nested element:
{
"query": {
"match_all":{}
},
"facets":{
"count_facet":{
"terms": {
"field": "count"
},
"nested": "childType"
}
}
}

Is there a way of achiving facets on the children?

Thanks

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.