usage.asciidoc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. [[java-rest-high-usage]]
  2. == Getting started
  3. This section describes how to get started with the high-level REST client from
  4. getting the artifact to using it in an application.
  5. [[java-rest-high-javadoc]]
  6. === Javadoc
  7. The javadoc for the REST high level client can be found at {rest-high-level-client-javadoc}/index.html.
  8. [[java-rest-high-usage-maven]]
  9. === Maven Repository
  10. The high-level Java REST client is hosted on
  11. http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.elasticsearch.client%22[Maven
  12. Central]. The minimum Java version required is `1.8`.
  13. The High Level REST Client is subject to the same release cycle as
  14. Elasticsearch. Replace the version with the desired client version.
  15. [[java-rest-high-usage-maven-maven]]
  16. ==== Maven configuration
  17. Here is how you can configure the dependency using maven as a dependency manager.
  18. Add the following to your `pom.xml` file:
  19. ["source","xml",subs="attributes"]
  20. --------------------------------------------------
  21. <dependency>
  22. <groupId>org.elasticsearch.client</groupId>
  23. <artifactId>elasticsearch-rest-high-level-client</artifactId>
  24. <version>{version}</version>
  25. </dependency>
  26. --------------------------------------------------
  27. [[java-rest-high-usage-maven-gradle]]
  28. ==== Gradle configuration
  29. Here is how you can configure the dependency using gradle as a dependency manager.
  30. Add the following to your `build.gradle` file:
  31. ["source","groovy",subs="attributes"]
  32. --------------------------------------------------
  33. dependencies {
  34. compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:{version}'
  35. }
  36. --------------------------------------------------
  37. [[java-rest-high-usage-dependencies]]
  38. === Dependencies
  39. The High Level Java REST Client depends on the following artifacts and their
  40. transitive dependencies:
  41. - org.elasticsearch.client:elasticsearch-rest-client
  42. - org.elasticsearch:elasticsearch
  43. [[java-rest-high-usage-initialization]]
  44. === Initialization
  45. A `RestHighLevelClient` instance needs a <<java-rest-low-usage-initialization,REST low-level client>>
  46. to be built as follows:
  47. [source,java]
  48. --------------------------------------------------
  49. RestHighLevelClient client =
  50. new RestHighLevelClient(lowLevelRestClient); <1>
  51. --------------------------------------------------
  52. <1> We pass the <<java-rest-low-usage-initialization,REST low-level client>> instance
  53. In the rest of this documentation about the Java High Level Client, the `RestHighLevelClient` instance
  54. will be referenced as `client`.