Issue 1:
Hi,

I'm noticing the reverse nested aggregation feature is available only for the nested data model but not for parent-child. We need to use parent-child since update latency is very important to us but noticing that aggregations which are several levels deep are not possible in a single query using parent child.

Here is how this can be done with the Nested model. Is this something which can be added for parent-child?

REQUEST:-

POST/document_test/document/_search?search_type=count{

"aggs": {

"created_date_agg": {

"nested": {

"path": "metadata"

},

"aggs": {

"created_date_agg_filter": {

"filter": {

"term": {

"fieldid": "CREATEDDATE"

}

},

"aggs": {

"created_date_agg_values": {

"terms": {

"field": "fieldvalue"

},

"aggs": {

"metadata_to_parent": {

"reverse_nested": {

},
"aggs": {
"filetype_agg": {
"nested": {
"path": "metadata"
},
"aggs": {
"filetype_agg_filter": {
"filter": {
"term": {
"fieldid": "DOCTYPE"
}
},
"aggs": {
"filetype_agg_values": {
"terms": {
"field": "fieldvalue"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}

}

RESPONSE:-

RESPONSE: -"aggregations": {

"created_date_agg": {

"doc_count": 12,

"created_date_agg_filter": {

"doc_count": 4,

"created_date_agg_values": {

"doc_count_error_upper_bound": 0,

"sum_other_doc_count": 0,

"buckets": [

{

"key": "6/9/2015",

"doc_count": 3,

"metadata_to_parent": {

"doc_count": 3,

"filetype_agg": {

"doc_count": 9,

"filetype_agg_filter": {

"doc_count": 3,

"filetype_agg_values": {

"doc_count_error_upper_bound": 0,

"sum_other_doc_count": 0,

"buckets": [

{

"key": "Excel",

"doc_count": 2

},

{

"key": "Microsoft Word",

"doc_count": 1

}

]

}

}

}

}

},

{

"key": "6/10/2015",

"doc_count": 1,

"metadata_to_parent": {

"doc_count": 1,

"filetype_agg": {

"doc_count": 3,

"filetype_agg_filter": {

"doc_count": 1,

"filetype_agg_values": {

"doc_count_error_upper_bound": 0,

"sum_other_doc_count": 0,

"buckets": [

{

"key": "Powerpoint",

"doc_count": 1

}

]

}

}

}

}

}

]

}

}

}

}

}

Issue 2:
I get these NPE after running after running for about 10 minutes or less. I did not see these NPEs with ES v1.4.1.

ES v1.4.2 on tribe node and the ES clusters the tribe node is aggregating.

[2015-01-06 04:08:01,591][WARN ][tribe ] [dc1-app1111] failed to process [cluster event from mobile_dc1, zen-disco-receive(from master [[dc1-app2222][TLF_56CDTV2dHXmUf0XFUg][dc1-app2222][inet[/172.24.23.163:9300]]{max_local_storage_nodes=1, master=true, zone=data}])]

java.lang.NullPointerException

at org.elasticsearch.cluster.routing.RoutingTable$Builder.add(RoutingTable.java:429)

at org.elasticsearch.tribe.TribeService$TribeClusterStateListener$1.execute(TribeService.java:265)

at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:329)

at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:153)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

Here is tribe config:

tribe:

mobile_dc1:

cluster.name: mobile-es_dc1

discovery.zen.ping.unicast.hosts: ["dc1-app2222", "dc1-app3333"]

mobile_dc2:

cluster.name: mobile-es_dc2

discovery.zen.ping.unicast.hosts: ["dc2-app2222", "dc2-app3333"]

mobile_dc3:

cluster.name: mobile-es_dc3

discovery.zen.ping.unicast.hosts: ["dc3-app2222", "dc3-app3333"]

feed_dc1:

cluster.name: dc1-logstash

discovery.zen.ping.unicast.hosts: ["dc1-app1234", "dc1-app1235"]

feed_dc2:

cluster.name: dc2-logstash

discovery.zen.ping.unicast.hosts: ["dc2-app2345", "dc2-app2346"]