-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOCS] Adds getting started content based on the template (#617)
Co-authored-by: Sylvain Wallez <[email protected]>
- Loading branch information
1 parent
bf459ff
commit 844e540
Showing
11 changed files
with
247 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
[[getting-started-java]] | ||
== Getting started | ||
|
||
This page guides you through the installation process of the Java client, shows | ||
you how to instantiate the client, and how to perform basic Elasticsearch | ||
operations with it. | ||
|
||
[discrete] | ||
=== Requirements | ||
|
||
* Java 8 or later. | ||
* A JSON object mapping library to allow seamless integration of | ||
your application classes with the Elasticsearch API. The examples below | ||
show usage with Jackson. | ||
|
||
[discrete] | ||
=== Installation | ||
|
||
[discrete] | ||
==== Installation in a Gradle project by using Jackson | ||
|
||
["source","groovy",subs="attributes+"] | ||
-------------------------------------------------- | ||
dependencies { | ||
implementation 'co.elastic.clients:elasticsearch-java:{version}' | ||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.3' | ||
} | ||
-------------------------------------------------- | ||
|
||
[discrete] | ||
==== Installation in a Maven project by using Jackson | ||
|
||
In the `pom.xml` of your project, add the following repository definition and | ||
dependencies: | ||
|
||
["source","xml",subs="attributes+"] | ||
-------------------------------------------------- | ||
<project> | ||
<dependencies> | ||
<dependency> | ||
<groupId>co.elastic.clients</groupId> | ||
<artifactId>elasticsearch-java</artifactId> | ||
<version>{version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.12.3</version> | ||
</dependency> | ||
</dependencies> | ||
</project> | ||
-------------------------------------------------- | ||
|
||
|
||
Refer to the <<installation>> page to learn more. | ||
|
||
|
||
[discrete] | ||
=== Connecting | ||
|
||
You can connect to the Elastic Cloud using an API key and the Elasticsearch | ||
endpoint. | ||
|
||
["source","java"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests-src}/getting_started/ConnectingTest.java[create-client] | ||
-------------------------------------------------- | ||
|
||
Your Elasticsearch endpoint can be found on the **My deployment** page of your | ||
deployment: | ||
|
||
image::images/es-endpoint.jpg[alt="Finding Elasticsearch endpoint",align="center"] | ||
|
||
You can generate an API key on the **Management** page under Security. | ||
|
||
image::images/create-api-key.png[alt="Create API key",align="center"] | ||
|
||
For other connection options, refer to the <<connecting>> section. | ||
|
||
|
||
[discrete] | ||
=== Operations | ||
|
||
Time to use Elasticsearch! This section walks you through the basic, and most | ||
important, operations of Elasticsearch. For more operations and more advanced | ||
examples, refer to the <<usage>> page. | ||
|
||
|
||
[discrete] | ||
==== Creating an index | ||
|
||
This is how you create the `product` index: | ||
|
||
["source","java"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests-src}/usage/IndexingTest.java[create-products-index] | ||
-------------------------------------------------- | ||
|
||
[discrete] | ||
==== Indexing documents | ||
|
||
This is a simple way of indexing a document, here a `Product` application object: | ||
|
||
["source","java"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-dsl] | ||
-------------------------------------------------- | ||
|
||
[discrete] | ||
==== Getting documents | ||
|
||
You can get documents by using the following code: | ||
|
||
["source","java"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests-src}/usage/ReadingTest.java[get-by-id] | ||
-------------------------------------------------- | ||
<1> The get request, with the index name and identifier. | ||
<2> The target class, here `Product`. | ||
|
||
|
||
[discrete] | ||
==== Searching documents | ||
|
||
This is how you can create a single match query with the Java client: | ||
|
||
["source","java"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests-src}/usage/SearchingTest.java[search-getting-started] | ||
-------------------------------------------------- | ||
|
||
[discrete] | ||
==== Updating documents | ||
|
||
This is how you can update a document, for example to add a new field: | ||
|
||
["source","java"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-update] | ||
-------------------------------------------------- | ||
|
||
|
||
|
||
[discrete] | ||
==== Deleting documents | ||
|
||
["source","java"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-delete] | ||
-------------------------------------------------- | ||
|
||
|
||
[discrete] | ||
==== Deleting an index | ||
|
||
["source","java"] | ||
-------------------------------------------------- | ||
include-tagged::{doc-tests-src}/usage/IndexingTest.java[create-products-index] | ||
-------------------------------------------------- | ||
|
||
|
||
[discrete] | ||
== Further reading | ||
|
||
* Learn more about the <<api-conventions>> of the Java client. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
docs/getting-started/index.asciidoc → docs/setup/index.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
== Getting started | ||
== Setup | ||
|
||
* <<installation>> | ||
* <<connecting>> | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters