|
1 |
| -# Event target for Elasticsearch |
| 1 | +# Event Target for Elasticsearch |
2 | 2 |
|
3 |
| -This event target receives [CloudEvents][ce] over HTTP and index their payload intoElasticsearch. |
| 3 | +This event Target receives [CloudEvents][ce] over HTTP and writes their payload to an [Elasticsearch][es] index. |
4 | 4 |
|
5 | 5 | ## Prerequisites
|
6 | 6 |
|
7 |
| -A Elasticsearch cluster and a set of credentials for indexing documents. |
| 7 | +1. If there is no pre-existing Elasticsearch cluster available, get started quickly by using either [Elastic Cloud on Kubernetes][eck] or [Elastic Cloud][elasticcloud]. |
8 | 8 |
|
9 |
| -You can get started by using: |
| 9 | +1. Retrieve credentials for the Elasticsearch cluster in either of the following forms: |
| 10 | + * User and password |
| 11 | + * API Key |
10 | 12 |
|
11 |
| -- [Elastic Cloud on Kubernetes][eck] |
12 |
| -- [Elascic Cloud][elasticcloud] |
| 13 | +Consult the [Elasticsearch documentation][docs] for more information on Elasticsearch. |
13 | 14 |
|
14 |
| -## Create the Elasticsearch target integration |
| 15 | +## Deploying an Instance of the Target |
15 | 16 |
|
16 |
| -Create the Elasticsearch target integration in 2 steps: |
| 17 | +Open the Bridge creation screen and add a Target of type `Elasticsearch`. |
17 | 18 |
|
18 |
| -1. Retrieve credentials for Elasticsearch. |
19 |
| -2. Create the Elasticsearch target. |
| 19 | + |
20 | 20 |
|
21 |
| -### Elasticsearch credentials |
| 21 | +In the Target creation form, give a name to the event Target and add the following information: |
22 | 22 |
|
23 |
| -Credentials for Elasticsearch which could be in the form: |
| 23 | +* **Index** : Name of the index to write documents to. |
| 24 | +* **Addresses** : List of URLs of Elasticsearch servers. |
| 25 | +* **Skip verify** : Allow skipping the server certificate verification. |
| 26 | +* **CA certificate** : CA certificate to be used by the event target's client, in PEM format. |
| 27 | +* **Username**: Elasticsearch username. |
| 28 | +* **Password**: Reference a [TriggerMesh secret][tm-secret] containing a password to communicate with the Elasticsearch API, as described in the previous section. |
| 29 | +* **API key**: Reference a [TriggerMesh secret][tm-secret] containing an API token to communicate with the Elasticsearch API, as described in the previous section. |
24 | 30 |
|
25 |
| -- User and password to the Elasticsearch cluster. |
26 |
| -- An APIKey instead of User and password. |
| 31 | +When using a self-signed certificate you will need to either inform the **CA certificate** or set the **Skip verify** field. |
27 | 32 |
|
28 |
| -Additionaly when using a self signed certificate you will need to either inform the `CACertificate` or set the `SkipVerify` field. |
| 33 | + |
29 | 34 |
|
30 |
| -### Deploy Elasticsearch target |
| 35 | +After clicking the `Save` button, the console will self-navigate to the Bridge editor. Proceed by adding the remaining components to the Bridge. |
31 | 36 |
|
32 |
| -At Triggermesh add a new secret depending on the credentials set: |
| 37 | +After submitting the Bridge, and allowing some configuration time, a green check mark on the main _Bridges_ page indicates that the Bridge with an Elasticsearch event Target was successfully created. |
33 | 38 |
|
34 |
| -- For username and password create a secret that contain a `password` key. |
35 |
| -- For API key create a secret that contain a `key` key. |
| 39 | + |
36 | 40 |
|
37 |
| -Then create a bridge that includes a Elasticsearch target: |
| 41 | +For more information about using Elasticsearch, please refer to the [Elasticsearch documentation][docs]. |
38 | 42 |
|
39 |
| -- `Name` is an internal identifier inside the bridge. |
40 |
| -- `Index` is the Elasticsearch index where documents will be indexed. |
41 |
| -- `Addresses` server address list. |
42 |
| -- `Skip verify` for skipping server certificate verification. |
43 |
| -- `CA certificate` is the Base64 encoding of the CA certificate for the server. |
| 43 | +## Event Types |
44 | 44 |
|
45 |
| -Credential fields can be provided either through username and password, or API key: |
| 45 | +The Elasticsearch event target can consume events of any type. |
46 | 46 |
|
47 |
| -- `Username` is the username for connecting. |
48 |
| -- `Password` secret with `password` key. |
49 |
| - |
50 |
| - |
51 |
| -- `APÎ Key` secret with `key`. |
52 |
| - |
53 |
| - |
54 |
| -## Events |
55 |
| - |
56 |
| -Elasticsearch Target will forward any JSON payload at the CloudEvent to be indexed. There is no requirement nor filters on the cloud events fields, the only requirement is that the payload data is a valid JSON. |
57 |
| - |
58 |
| -It would be desirable that the JSON conforms to the index mapping at elasticsearch. |
59 |
| - |
60 |
| -### Example |
61 |
| - |
62 |
| -```console |
63 |
| -curl -v http://elasticsearchtarget \ |
64 |
| - -X POST \ |
65 |
| - -H "Content-Type: application/json" \ |
66 |
| - -H "Ce-Specversion: 1.0" \ |
67 |
| - -H "Ce-Type: my.data.type" \ |
68 |
| - -H "Ce-Source: some.origin/intance" \ |
69 |
| - -H "Ce-Id: 536808d3-88be-4077-9d7a-a3f162705f79" \ |
70 |
| - -d '{"message":"thanks for indexing this message","from": "Triggermesh targets", "some_number": 12}' |
71 |
| -``` |
| 47 | +[eck]: https://github.com/elastic/cloud-on-k8s |
| 48 | +[elasticcloud]: https://www.elastic.co/cloud/ |
| 49 | +[es]:https://www.elastic.co/elasticsearch/ |
| 50 | +[docs]:https://www.elastic.co/guide/index.html |
72 | 51 |
|
73 | 52 | [ce]: https://cloudevents.io
|
74 |
| -[eck]: https://github.com/elastic/cloud-on-k8s |
75 |
| -[elasticcloud]: https://www.elastic.co/cloud/ |
| 53 | + |
| 54 | +[tm-secret]: ../guides/secrets.md |
0 commit comments