1

I made some elastic query like below.

"aggregations": {
      "state": {
         "nested": {
            "path": "events"
         },
         "aggregations": {
            "by_act": {
               "cardinality": {
                  "field": "events.activityoid"
               }
            }
         }
      },
      "by_event": {
         "sum": {
            "field": "eventcnt"
         }
      }

And here is part of result.

"aggregations": {
      "by_event": {
         "value": 132
      },
      "state": {
         "doc_count": 1874,
         "by_act": {
            "value": 12
         },

I can get 'by_event' value with

result.getAggregations().getCardinalityAggregation( "by_cases").getCardinality();

But Don't know How to get 'by_act' value, since it's not in bucket. Any idea of this?

Machavity
  • 30,841
  • 27
  • 92
  • 100
J.Done
  • 2,783
  • 9
  • 31
  • 58
  • Have you tried to put a breakpoint in your code in order to see how to navigate within the results and get what you want? – Val May 20 '16 at 08:07
  • I did. there is result data in result.getAggregations().getTermsAggregation( "state").jsonRoot, but cannot get them out with jest. – J.Done May 20 '16 at 08:11

0 Answers0