Skip to content

Commit

Permalink
Merge pull request #605 from elastic/szabosteve/serverless.docs
Browse files Browse the repository at this point in the history
[DOCS] Adds getting started MDX to the serverless client docs
  • Loading branch information
szabosteve authored Jun 28, 2023
2 parents 9188e9b + 1ce6be5 commit f49fc4b
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
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.

0 comments on commit f49fc4b

Please sign in to comment.