# Java API \[2.1\] documentation code

**URL:** <https://discuss.elastic.co/t/java-api-2-1-documentation-code/37144>\
**Category:** Elasticsearch\
**Created:** [December 14, 2015, 4:35pm UTC](https://discuss.elastic.co/t/java-api-2-1-documentation-code/37144 "2015-12-14T16:35:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_Lawson](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@Bob\_Lawson](https://discuss.elastic.co/u/Bob_Lawson)\
**Post date:** [December 14, 2015, 4:35pm UTC](https://discuss.elastic.co/t/java-api-2-1-documentation-code/37144/1 "2015-12-14T16:35:05Z")

</div>

I'm a newcomer to ElasticSearch and I've been reading the [Java API [2.1] documentation code](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/index.html). 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.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [December 14, 2015, 4:49pm UTC](https://discuss.elastic.co/t/java-api-2-1-documentation-code/37144/2 "2015-12-14T16:49:19Z")

</div>

> [@Bob\_Lawson](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Bob\_Lawson](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@Bob\_Lawson](https://discuss.elastic.co/u/Bob_Lawson)\
**Post date:** [December 17, 2015, 8:20pm UTC](https://discuss.elastic.co/t/java-api-2-1-documentation-code/37144/3 "2015-12-17T20:20:48Z")

</div>

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:30pm UTC](https://discuss.elastic.co/t/java-api-2-1-documentation-code/37144/4 "2017-07-05T23:30:05Z")

</div>


