As mentioned before, you will still get the metadata. With the Java API,
you can get the aggregations back directly from the SearchResponse object,
which is a list of Aggregation objects:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/search/SearchResponse.java#L103-L105

-- 
Ivan




On Thu, May 22, 2014 at 11:00 PM, Subhadip Bagui <[email protected]> wrote:

>
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/47f686b0-e844-410b-955e-6dfb88221569%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/47f686b0-e844-410b-955e-6dfb88221569%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQA-Q_s51SuWOpcqPc-ALu_bWVy6ehsMcH59KoGYH9Hyhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to