termlistRequest.setSize(request.paramAsInt("size", 0));
termlistRequest.setWithDocFreq(request.paramAsBoolean("docfreqs", false));
termlistRequest.setWithTotalFreq(request.paramAsBoolean("totalfreqs", false));
termlistRequest.sortByDocFreq(request.paramAsBoolean("sortbydocfreqs", false));
termlistRequest.sortByTotalFreq(request.paramAsBoolean("sortbytotalfreqs", false));
termlistRequest.sortByTerm(request.paramAsBoolean("sortbyterms", false));
client.execute(TermlistAction.INSTANCE, termlistRequest, new RestBuilderListener<TermlistResponse>(channel) {
@Override
public RestResponse buildResponse(TermlistResponse response, XContentBuilder builder) throws Exception {
builder.startObject();
buildBroadcastShardsHeader(builder, response);