Java code for Elasticsearch DSL

I have a elastic DSL query , Could you please guide me a bit how can i query elastic same from java code. I have read elasticsearch java api docs , and able to create client and get response for simple queries , but here i need to use stored script and 3 aggregations . Please guide me .

   GET /_search/
        {
          "size" : 0,
          "query" : {
            "match_all" : {
            }
          },
          "aggregations" : {
            "STAT_YEAR" : {
              "terms" : {
                "field" : "STAT_YEAR.keyword"
                },
              "aggregations" : {
                "AGE_BAND" : {
                  "terms" : {
                    "script" : {
                      "stored":"credit_limit"
                    }
                  },
                  "aggregations" : {
                    "COUNT_APPL_NO" : {
                      "value_count" : {
                        "field" : "APPL_NO.keyword"
                      }
                    }
                  }
                }
              }
            }
          }
        }

This page describes how to use aggregations with Java High Level Rest Client.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.