formatting the elasticsearch output as code