Java API [2.1] documentation code

I'm a newcomer to ElasticSearch and I've been reading the Java API [2.1] documentation code. There are a lot of code snippets in the documentation. Can anyone tell me if this code is available for download anywhere?

If not, could you suggest a good sample to download? I'm just trying to learn the Java API and the kind of things you can do with it, and I always learn better by running code and stepping through it.

The best example I can think of is Elasticsearch's integration tests. Checkout Elasticsearch's source and crack it open in your favorite IDE. Sadly, because its in tests, many of the examples contain thing that (almost) only make sense for testing (lots of manual calls to refresh for example) and there are lots of layers of abstraction that add randomization, which will just get in the way of your reading. Sorry about that.

Bonus: you get familiar with the randomized testing setup that Elasticsearch uses. Its pretty nice and worth bringing to other JVM projects.

Thanks for the help!