title: Send Response in 'then' after Promise resolves
body: <p>I want to display the json i got from the search for <code>localhost:8400/api/v1/search</code>. But I have no idea how. </p>
  
  <p>I'm using the Elasticsearch Javascript Client</p>
  
  <p>my routing:</p>
  
  <pre><code>'use-strict';
  const express = require('express');
  const elasticsearch = require('../models/elasticsearch.js');
  
  const router = express.Router();
  
  router.get('/api/v1/search', elasticsearch.search);
  </code></pre>
  
  <p>for accessing the ElasticSearch DB</p>
  
  <pre><code>const es = require('elasticsearch');
  
  let esClient = new es.Client({
    host: 'localhost:9200',
    log: 'info',
    apiVersion: '5.3',
    requestTimeout: 30000
  })
  
  let indexName = "randomindex";
  
  const elasticsearch = {
  
    search() {
      return esClient.search({
        index: indexName,
        q: "test"
      })
        .then(() =&gt; {
          console.log(JSON.stringify(body));
          // here I want to return a Response with the Content of the body
        })
        .catch((error) =&gt; { console.trace(error.message); });
    }
  }
  
  module.exports = elasticsearch;
  </code></pre>