Thanks Ivan for your reply. I tried with *size : 0* but still the metadata is coming. Is there any way to suppress the metadata. Can I use java api to do so. Earlier I used the method like below to get the source response only. Can we do that for aggregation also?
public String searchESIndex(String index, String type) { Client client = ESClientFactory.getInstance(); SearchRequestBuilder srequest = client.prepareSearch(index) .setTypes(type).setSearchType(SearchType.QUERY_AND_FETCH) .setQuery(QueryBuilders.matchQuery("status", "SUSPEND")) .setSize(1); SearchResponse sresp = srequest.execute().actionGet(); List<Map<String, Object>> listOfSource = new ArrayList<Map<String, Object>>(); for (SearchHit hits : sresp.getHits()) { listOfSource.add(hits.getSource()); } Gson gson = new Gson(); String jsonSourceList = gson.toJson(listOfSource); return jsonSourceList; } -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/47f686b0-e844-410b-955e-6dfb88221569%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.