How to create a SearchResponce in java elastic api, with aggregations and sort? : <p>How to create a SearchResponce in java elastic api, with aggregations? So that it looks like a request to elastic?
Example:</p>

<pre><code>{
    "_source":"username",
    "size":0,
    "aggs":{
            "users":{
                "terms":{
                    "field":"username.keyword",
                    "order": {
                        "sum":"desc"
                    }
                },
                "aggs": {
                    "sum": {
                        "sum": {
                            "field":"fileSize"
                        }
                    }
                }
            },
    "total": {
        "cardinality": {
            "field":"username.keyword"
            }
        }
    }
}
</code></pre>
