71 lines
2.4 KiB
Markdown
71 lines
2.4 KiB
Markdown
---
|
|
outline: [2, 3]
|
|
description: Learn how to integrate your app with Elasticsearch service in beOS Pro.
|
|
---
|
|
# Integrate with Elasticsearch
|
|
|
|
Use beOS Pro Elasticsearch middleware by declaring it in `beOS ProManifest.yaml`, then mapping the injected values to your container environment variables.
|
|
|
|
## Install Elasticsearch service
|
|
|
|
Install the Elasticsearch service from Market.
|
|
|
|
1. Open Market from Launchpad and search for "Elasticsearch".
|
|
2. Click **Get**, then **Install**, and wait for the installation to complete.
|
|
|
|
Once installed, the service and its connection details will appear in the Middleware list in Control Hub.
|
|
|
|
## Configure `beOS ProManifest.yaml`
|
|
|
|
In `beOS ProManifest.yaml`, add the required middleware configuration.
|
|
|
|
- Use the `username` field to specify the Elasticsearch user.
|
|
- Use the `indexes` field to request one or more indexes. Each index name is used as the key in `.Values.elasticsearch.indexes`.
|
|
|
|
**Example**
|
|
|
|
```yaml
|
|
middleware:
|
|
elasticsearch:
|
|
username: elasticlient
|
|
indexes:
|
|
- name: aaa
|
|
```
|
|
|
|
## Map to environment variables
|
|
In your deployment YAML, map the injected `.Values.elasticsearch.*` fields to the container environment variables your app requires.
|
|
|
|
**Example**
|
|
```yaml
|
|
containers:
|
|
- name: my-app
|
|
env:
|
|
- name: ES_HOST
|
|
value: "{{ .Values.elasticsearch.host }}"
|
|
|
|
- name: ES_PORT
|
|
value: "{{ .Values.elasticsearch.port }}"
|
|
|
|
- name: ES_USER
|
|
value: "{{ .Values.elasticsearch.username }}"
|
|
|
|
- name: ES_PASSWORD
|
|
value: "{{ .Values.elasticsearch.password }}"
|
|
|
|
# Index name
|
|
# The index name configured in beOS ProManifest (for example, aaa)
|
|
- name: ES_INDEX
|
|
value: "{{ .Values.elasticsearch.indexes.aaa }}"
|
|
```
|
|
|
|
## Elasticsearch values reference
|
|
|
|
Elasticsearch values are predefined runtime values injected into `values.yaml` during deployment. They are system-managed and not user-editable.
|
|
|
|
| Value | Type | Description |
|
|
| --- | --- | --- |
|
|
| `.Values.elasticsearch.host` | String | Elasticsearch service host. |
|
|
| `.Values.elasticsearch.port` | Number | Elasticsearch service port. |
|
|
| `.Values.elasticsearch.username` | String | Elasticsearch username. |
|
|
| `.Values.elasticsearch.password` | String | Elasticsearch password. |
|
|
| `.Values.elasticsearch.indexes` | Map\<String,String> | Requested indexes, keyed by index name. For example, a request for `aaa` is available at `.Values.elasticsearch.indexes.aaa`. | |