Are you using the Elasticsearch Java client? Do you have any code so far? There is an aggregation example in the documentation that may help you get started.
thanks for replay yes im using java client i have done some code but the output is not coming as expected. can pls give me code for this query so that i can refer. it would be very helpful for me. I have gone through that document already.
Hi Shubh, can you share the code you have and what output or error you are receiving please? It would be good to understand what output you have versus what you expect.
@carly.richmond Here is my code. as per the document you shared me im not able to get The response of an aggregation which we have to run in for loop getting some som erro in code as well pls correct me or send me the right code.
Hi Shubh, you say you're getting an error. What is the error?
Can you also confirm if you are using the Java REST Client or the Java API Client and what versions of that client and Elasticsearch you are using? From the references in your code it looks like you are using the REST client which is deprecated as of 7.17 in favour of the API client. So we would recommend switching to the Java API client.
The discuss forum is best effort help for Elasticsearch, as well as educating the community. We are not a support forum. If others have similar snippets and experiences they may share.
I suggest following the code example for the Java API client mentioned above. That example also includes an example of how to process the aggregation response in the second snippet that covers how to process the response.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.