Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Adds getting started MDX to the serverless client docs #605

Merged
merged 5 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions java-client-serverless/docs/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
id: gettingStartedServerlessJava
slug: /serverless-java/docs/getting-started
title: Getting started with the Serverless Java client
description: This page contains quickstart information about the Serverless Java client.
date: 2023-06-27
tags: ['serverless','Java client','docs', 'getting started', 'Java']
---

This page guides you through the installation process of the Serverless Java
client, shows you how to instantiate the client, and how to perform basic
Elasticsearch operations with it.

## Requirements

[TO DO]

## Installation

### Using the command line

You can install the Elasticsearch Serverless Java client with the following
commands:

```bash
```


## Instantiate a client

You can instantiate a client by running the following command:

```java

```

You can find the Elasticsearch endpoint on the Cloud deployment management page.

<DocImage url="images/copy-endpoint.gif" alt="Copy the endpoint for Elasticsearch"/>

You can create a new API Key under **Stack Management** > **Security**:

<DocImage url="images/setup-api-key.gif" alt="Create and copy API Key"/>


## Using the API

After you instantiated a client with your API key and Elasticsearch endpoint,
you can start ingesting documents into the Elasticsearch Service. You can use
the Bulk API for this. This API enables you to index, update, and delete several
documents in one request.


### Creating an index and ingesting documents

You can call the `bulk` API with a body parameter, an array of hashes that
define the action, and a document.

The following is an example of indexing some classic books into the `books`
index:

```java

```

When you use the client to make a request to Elasticsearch, it returns an API
response object. You can check the HTTP return code by calling `status` and the
HTTP headers by calling `headers` on the response object. The response object
also behaves as a Hash, so you can access the body values directly as seen on
the previous example with ``.


### Searching

Now that some data is available, you can search your documents using the
**Search API**:

```java
```

### Updating

You can update your documents using the Bulk API:

```java
```

### Delete

You can also delete documents:

```java
```
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.
Empty file removed java-client-serverless/index.mdx
Empty file.