title: Elasticsearch get only file ids
body: <p>Is there a way in elasticsearch using JAVA API to get only the ids of the documents returned for a give query.</p>
  
  <pre><code>SearchResponse sr =  esClient.prepareSearch(index).setSize(resultSize).setScroll(new TimeValue(10000)).setQuery(fqb).setFetchSource(false).get();
  </code></pre>
  
  <p>but I get empty hits (<code>sr.getHits().hits[].length == 0</code>) althouh the total count of returned hits is 0 (<code>sr.getHits().getTotalHits == 2</code>). I understand that nothing is returned by elasticsearch because I set fetch source to false, but the ids should somehow be available. My current solution is:</p>
  
  <pre><code>SearchResponse sr =  esClient.prepareSearch(index).setSize(resultSize).setScroll(new TimeValue(10000)).setQuery(fqb).srb.setFetchSource("_id", null).get();
  </code></pre>
  
  <p>However I think that gets the _id field from source, and for speed I would like to avoid this if possible.</p>
  
  <p>Thanks,
  Ilija</p>