Hey,
as the groovy version used in elasticsearch is not containing that JsonOutput class, you cannot call it either. You would either need to create that JSON manually in the output, but I highly urge you to upgrade to 2.4, so you wont have any problems using the {{#toJson}} mustache directive.
--Alex