Java method should be written for the following ES query and I'm getting an error on script() function.
"AVERAGE": {
"bucket_script": {
"buckets_path": {
"SUM_TWO": "2ycc",
"SUM_RESEARCH": "roc"
},
"script": "params.SUM_TWO / params.SUM_RESEARCH"
}
}
Map<String, String> dictionary = new HashMap<>();
dictionary.put(field1, field2);
dictionary.put(field1, field2);
String scriptCode = "params.SUM_TWO / params.SUM_RESEARCH";
return new Aggregation.Builder()
.bucketScript(new BucketScriptAggregation.Builder().bucketsPath(new BucketsPath.Builder().dict(dictionary).build()).script(t -> t.inline(scriptCode))).build();