title: Sorting on elastic search with node js
body: <p>For some reason, when I trying to search and sort from an index</p>
  
  <p>This works:</p>
  
  <pre><code>GET indexName/_search
  {      
      "sort": [{
        "_uid": { "order": "desc" }
      }],
      "size": 1
  
  }
  </code></pre>
  
  <p>But, when using node js like this:</p>
  
  <pre><code>elasticClient.search({
       index: indexName,
       type: id,
       sort: [{ "_uid": { "order": "desc" } }],
       size: 1
   })
  </code></pre>
  
  <p>It returns an error: </p>
  
  <pre><code>No mapping found for [[object Object]] in order to sort on
  
  
  status :400
  </code></pre>
  
  <p>I've tried <code>JSON.stringify</code> and all kind of other things, but none of them works</p>
  
  <p>Please, can anyone help me?</p>