You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get started with Amazon Elasticsearch Service (ES) on LocalStack
3
+
description: Get started with Amazon Elasticsearch Service (ES) on LocalStack
6
4
tags: ["Free"]
7
5
---
8
6
7
+
## Introduction
8
+
9
9
The Elasticsearch Service in LocalStack lets you create one or more single-node Elasticsearch/OpenSearch cluster that behaves like the [Amazon Elasticsearch Service](https://aws.amazon.com/opensearch-service/the-elk-stack/what-is-elasticsearch/).
10
10
This service is, like its AWS counterpart, heavily linked with the [OpenSearch Service](../opensearch).
11
11
Any cluster created with the Elasticsearch Service will show up in the OpenSearch Service and vice versa.
12
12
13
13
## Creating an Elasticsearch cluster
14
14
15
-
You can go ahead and use [awslocal]({{< ref "aws-cli.md#localstack-aws-cli-awslocal" >}}) to create a new elasticsearch domain via the `aws es create-elasticsearch-domain` command.
15
+
You can go ahead and use [`awslocal`](https://github.com/localstack/awscli-local) to create a new elasticsearch domain via the `aws es create-elasticsearch-domain` command.
16
16
17
-
{{< callout >}}
17
+
:::note
18
18
Unless you use the Elasticsearch default version, the first time you create a cluster with a specific version, the Elasticsearch binary is downloaded, which may take a while to download.
19
-
{{< /callout >}}
19
+
:::
20
+
21
+
```bash
22
+
awslocal es create-elasticsearch-domain --domain-name my-domain
23
+
```
20
24
21
-
{{< command >}}
22
-
$ awslocal es create-elasticsearch-domain --domain-name my-domain
25
+
The following output would be retrieved:
26
+
27
+
```json
23
28
{
24
29
"DomainStatus": {
25
30
"DomainId": "000000000000/my-domain",
@@ -49,11 +54,11 @@ $ awslocal es create-elasticsearch-domain --domain-name my-domain
49
54
}
50
55
}
51
56
}
52
-
{{< / command >}}
57
+
```
53
58
54
59
In the LocalStack log you will see something like the following, where you can see the cluster starting up in the background.
2021-11-08T16:29:28:INFO:localstack.services.es.cluster: registering an endpoint proxy for http://my-domain.us-east-1.es.localhost.localstack.cloud:4566 => http://127.0.0.1:57705
59
64
2021-11-08T16:29:30:INFO:localstack.services.es.cluster: OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
@@ -68,10 +73,16 @@ In the LocalStack log you will see something like the following, where you can s
68
73
69
74
and after some time, you should see that the `Processing` state of the domain is set to `false`:
70
75
71
-
{{< command >}}
72
-
$ awslocal es describe-elasticsearch-domain --domain-name my-domain | jq ".DomainStatus.Processing"
76
+
```bash
77
+
awslocal es describe-elasticsearch-domain --domain-name my-domain | jq ".DomainStatus.Processing"
78
+
```
79
+
80
+
The following output would be retrieved:
81
+
82
+
```bash
73
83
false
74
-
{{< / command >}}
84
+
```
85
+
75
86
76
87
## Interact with the cluster
77
88
@@ -80,8 +91,13 @@ in this case `http://my-domain.us-east-1.es.localhost.localstack.cloud:4566`.
@@ -134,7 +155,7 @@ There are three configurable strategies that govern how domain endpoints are cre
134
155
| - | - | - |
135
156
|`domain`|`<domain-name>.<region>.es.localhost.localstack.cloud:4566`| This is the default strategy that uses the `localhost.localstack.cloud` domain to route to your localhost |
136
157
|`path`|`localhost:4566/es/<region>/<domain-name>`| An alternative that can be useful if you cannot resolve LocalStack's localhost domain |
137
-
|`port`|`localhost:<port-from-range>`| Exposes the cluster(s) directly with ports from the [external service port range]({{< ref "external-ports" >}})|
158
+
|`port`|`localhost:<port-from-range>`| Exposes the cluster(s) directly with ports from the [external service port range]()|
138
159
|`off`||*Deprecated*. This value now reverts to the `port` setting, using a port from the given range instead of `4571`|
139
160
140
161
Regardless of the service from which the clusters were created, the domain of the cluster always corresponds to the engine type (OpenSearch or Elasticsearch) of the cluster.
@@ -146,17 +167,17 @@ LocalStack allows you to set arbitrary custom endpoints for your clusters in the
146
167
This can be used to overwrite the behavior of the endpoint strategies described above.
147
168
You can also choose custom domains, however it is important to add the edge port (`80`/`443` or by default `4566`).
148
169
149
-
{{< command >}}
150
-
$ awslocal es create-elasticsearch-domain --domain-name my-domain \
170
+
```bash
171
+
awslocal es create-elasticsearch-domain --domain-name my-domain \
3. If the `Processing` status is true, it means that the cluster is not yet healthy.
289
-
You can run `describe-elasticsearch-domain` to receive the status:
290
-
{{< command >}}
291
-
$ awslocal es describe-elasticsearch-domain --domain-name mylogs-2
292
-
{{< /command >}}
314
+
3. If the `Processing` status is true, it means that the cluster is not yet healthy. You can run `describe-elasticsearch-domain` to receive the status:
315
+
```bash
316
+
awslocal es describe-elasticsearch-domain --domain-name mylogs-2
317
+
```
293
318
294
319
4. Check the cluster health endpoint and create indices:
0 commit comments