@SuppressWarnings("nls")
    @Override
    protected void doXContent(XContentBuilder builder) throws IOException {
        if (from != null) {
            builder.field("from", from);
        }
        if (size != null) {
            builder.field("size", size);
        }

        if (query != null) {
            builder.field("query");
            query.toXContent(builder);
        }

        if (!sorts.isEmpty()) {
            builder.startArray("sort");
            for (SortInfo sortInfo : sorts) {
                builder.startObject();
                builder.startObject(sortInfo.sortFieldName);
                builder.field("order", sortInfo.sortOrder.toString());
                builder.endObject();
                builder.endObject();
            }
            builder.endArray();
        }

        if (fetchSource) {
            builder.field("_source", true);
        }
        
        if (fetchIncludes != null) {
            builder.field("_source");
            builder.startObject();
            builder.array("include", fetchIncludes);
            builder.endObject();
        }
    }
@see io.apiman.manager.api.es.util.AbstractQueryBuilder#doXContent(io.apiman.manager.api.es.util.XContentBuilder)
manager/api/es/src/main/java/io/apiman/manager/api/es/util/SearchSourceBuilder.java