This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
commit 1cfab28ce7c66628b2f9cebcdf79bebf4620458d Author: Andrea Cosentino <[email protected]> AuthorDate: Wed Jul 14 16:53:07 2021 +0200 ElasticSearch Index Sink: Fixed user/password as optional and fixed the headers settings --- elasticsearch-index-sink.kamelet.yaml | 84 ++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 31 deletions(-) diff --git a/elasticsearch-index-sink.kamelet.yaml b/elasticsearch-index-sink.kamelet.yaml index 2482537..04a793d 100644 --- a/elasticsearch-index-sink.kamelet.yaml +++ b/elasticsearch-index-sink.kamelet.yaml @@ -27,12 +27,13 @@ spec: Input data must have JSON format according to the index used. - If the *indexId* parameter is set, that value will be used as the document ID on ElasticSearch. + - `indexId` / `ce-indexId`: as the index ID for Elasticsearch - If the *indexId* parameter is not set and the source of the kamelet binding is a Kafka broker, it will take the kafka topic, partition and offset of the - element to generate an automatic ID that warrantees that this element is processed only once. + If the header won't be set the exchange ID will be used as index. - If the *indexName* parameter is not set and the source of the kamelet binding is a Kafka broker, it will take the kafka topic as the indexName. + - `indexName` / `ce-indexName`: as the index Name for Elasticsearch + + If the header won't be set the exchange ID will be used as index name. required: - clusterName - hostAddresses @@ -46,6 +47,9 @@ spec: title: Password description: Password to connect to ElasticSearch. type: string + format: password + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password enableSSL: title: Enable SSL description: Do we want to connect using SSL? @@ -89,30 +93,48 @@ spec: from: uri: kamelet:source steps: - - choice: - when: - - simple: "'{{indexId}}' == 'NONE' && ${header[kafka.TOPIC]} != null" - steps: - - set-header: - name: "indexId" - simple: "${header[kafka.TOPIC]}${header[kafka.PARTITION]}${header[kafka.OFFSET]}" - - simple: "'{{indexId}}' != 'NONE'" - steps: - - set-header: - name: "indexId" - simple: "{{indexId}}" - - choice: - when: - - simple: "'{{indexName}}' == 'NONE'" - steps: - - set-property: - name: esIndexName - simple: "${header[kafka.TOPIC]}" - otherwise: - steps: - - set-property: - name: esIndexName - simple: "{{indexName}}" - - to-d: "kamelet-reify:elasticsearch-rest:{{clusterName}}?hostAddresses=RAW({{hostAddresses}})&operation=INDEX&indexName=${exchangeProperty.esIndexName}&enableSSL={{enableSSL}}&user={{user}}&password={{password}}" - - marshal: - json: { } + - choice: + when: + - simple: "${header[indexId]}" + steps: + - set-header: + name: "indexId" + simple: "${header[indexId]}" + - simple: "${header[ce-indexId]}" + steps: + - set-header: + name: "indexId" + simple: "${header[ce-indexId]}" + otherwise: + steps: + - set-header: + name: "indexId" + simple: "${exchangeId}" + - choice: + when: + - simple: "${header[indexName]}" + steps: + - set-header: + name: "indexName" + simple: "${header[indexName]}" + - simple: "${header[ce-indexName]}" + steps: + - set-header: + name: "indexName" + simple: "${header[ce-indexName]}" + otherwise: + steps: + - set-header: + name: "indexName" + simple: "${exchangeId}" + - to: + uri: "kamelet-reify:elasticsearch-rest:{{clusterName}}" + parameters: + operation: "INDEX" + indexName: "{{indexName}}" + hostAddresses: "{{hostAddresses}}" + enableSSL: "{{enableSSL}}" + user: "{{?user}}" + password: "{{?password}}" + - marshal: + json: { }
