The Elasticsearch API reference provides examples of requests in various languages, including Java, available in the dropdown menu on the right.