Skip to content

Commit f49fc4b

Browse files
authored
Merge pull request #605 from elastic/szabosteve/serverless.docs
[DOCS] Adds getting started MDX to the serverless client docs
2 parents 9188e9b + 1ce6be5 commit f49fc4b

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
id: gettingStartedServerlessJava
3+
slug: /serverless-java/docs/getting-started
4+
title: Getting started with the Serverless Java client
5+
description: This page contains quickstart information about the Serverless Java client.
6+
date: 2023-06-27
7+
tags: ['serverless','Java client','docs', 'getting started', 'Java']
8+
---
9+
10+
This page guides you through the installation process of the Serverless Java
11+
client, shows you how to instantiate the client, and how to perform basic
12+
Elasticsearch operations with it.
13+
14+
## Requirements
15+
16+
[TO DO]
17+
18+
## Installation
19+
20+
### Using the command line
21+
22+
You can install the Elasticsearch Serverless Java client with the following
23+
commands:
24+
25+
```bash
26+
```
27+
28+
29+
## Instantiate a client
30+
31+
You can instantiate a client by running the following command:
32+
33+
```java
34+
35+
```
36+
37+
You can find the Elasticsearch endpoint on the Cloud deployment management page.
38+
39+
<DocImage url="images/copy-endpoint.gif" alt="Copy the endpoint for Elasticsearch"/>
40+
41+
You can create a new API Key under **Stack Management** > **Security**:
42+
43+
<DocImage url="images/setup-api-key.gif" alt="Create and copy API Key"/>
44+
45+
46+
## Using the API
47+
48+
After you instantiated a client with your API key and Elasticsearch endpoint,
49+
you can start ingesting documents into the Elasticsearch Service. You can use
50+
the Bulk API for this. This API enables you to index, update, and delete several
51+
documents in one request.
52+
53+
54+
### Creating an index and ingesting documents
55+
56+
You can call the `bulk` API with a body parameter, an array of hashes that
57+
define the action, and a document.
58+
59+
The following is an example of indexing some classic books into the `books`
60+
index:
61+
62+
```java
63+
64+
```
65+
66+
When you use the client to make a request to Elasticsearch, it returns an API
67+
response object. You can check the HTTP return code by calling `status` and the
68+
HTTP headers by calling `headers` on the response object. The response object
69+
also behaves as a Hash, so you can access the body values directly as seen on
70+
the previous example with ``.
71+
72+
73+
### Searching
74+
75+
Now that some data is available, you can search your documents using the
76+
**Search API**:
77+
78+
```java
79+
```
80+
81+
### Updating
82+
83+
You can update your documents using the Bulk API:
84+
85+
```java
86+
```
87+
88+
### Delete
89+
90+
You can also delete documents:
91+
92+
```java
93+
```
Loading
Loading

java-client-serverless/index.mdx

Whitespace-only changes.

0 commit comments

Comments
 (0)