This is an automated email from the ASF dual-hosted git repository. oscerd pushed a commit to branch backport/23212-to-camel-4.14.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 0fbafe2614bf9872f006cc192ce35aa766e2e63f Author: Andrea Cosentino <[email protected]> AuthorDate: Thu May 14 14:38:04 2026 +0200 CAMEL-23508: camel-elasticsearch-rest-client - align Exchange header constant names with Camel naming convention Rename the Exchange header string values in ElasticSearchRestClientConstant from raw uppercase (ID, SEARCH_QUERY, INDEX_SETTINGS, INDEX_NAME, OPERATION) to the Camel naming convention (CamelElasticsearchId, CamelElasticsearchSearchQuery, CamelElasticsearchIndexSettings, CamelElasticsearchIndexName, CamelElasticsearchOperation). The Java field names are unchanged so routes referencing the constants symbolically continue to work. Routes using the literal string value must be updated. Adds an entry to the 4.21 upgrade guide and regenerates the affected component metadata, catalog, and endpoint DSL. Closes #23212 --- .../components/elasticsearch-rest-client.json | 10 ++++---- .../rest/client/elasticsearch-rest-client.json | 10 ++++---- .../docs/elasticsearch-rest-client-component.adoc | 18 ++++++------- .../client/ElasticSearchRestClientConstant.java | 10 ++++---- ...sticsearchRestClientEndpointBuilderFactory.java | 30 +++++++++++----------- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/elasticsearch-rest-client.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/elasticsearch-rest-client.json index 26a113934538..1e4fc725aea1 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/elasticsearch-rest-client.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/elasticsearch-rest-client.json @@ -38,11 +38,11 @@ "user": { "index": 11, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Username" } }, "headers": { - "ID": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "ID of the object to index or retrieve or delete", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#ID" }, - "SEARCH_QUERY": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The JSON Query to perform for search", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#SEARCH_QUERY" }, - "INDEX_SETTINGS": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Advanced - The JSON Index Settings and\/or Mappings Query to perform to create an index", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_SETTINGS" }, - "INDEX_NAME": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Index name", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_NAME" }, - "OPERATION": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation", "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", "DELETE_INDEX", "SEARCH" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform", "constantName": "org.apache.camel.component.elasti [...] + "CamelElasticsearchId": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "ID of the object to index or retrieve or delete", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#ID" }, + "CamelElasticsearchSearchQuery": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The JSON Query to perform for search", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#SEARCH_QUERY" }, + "CamelElasticsearchIndexSettings": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Advanced - The JSON Index Settings and\/or Mappings Query to perform to create an index", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_SETTINGS" }, + "CamelElasticsearchIndexName": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Index name", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_NAME" }, + "CamelElasticsearchOperation": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation", "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", "DELETE_INDEX", "SEARCH" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform", "constantName": "org.apache.came [...] }, "properties": { "clusterName": { "index": 0, "kind": "path", "displayName": "Cluster Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Cluster Name" }, diff --git a/components/camel-elasticsearch-rest-client/src/generated/resources/META-INF/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json b/components/camel-elasticsearch-rest-client/src/generated/resources/META-INF/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json index 26a113934538..1e4fc725aea1 100644 --- a/components/camel-elasticsearch-rest-client/src/generated/resources/META-INF/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json +++ b/components/camel-elasticsearch-rest-client/src/generated/resources/META-INF/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json @@ -38,11 +38,11 @@ "user": { "index": 11, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Username" } }, "headers": { - "ID": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "ID of the object to index or retrieve or delete", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#ID" }, - "SEARCH_QUERY": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The JSON Query to perform for search", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#SEARCH_QUERY" }, - "INDEX_SETTINGS": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Advanced - The JSON Index Settings and\/or Mappings Query to perform to create an index", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_SETTINGS" }, - "INDEX_NAME": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Index name", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_NAME" }, - "OPERATION": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation", "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", "DELETE_INDEX", "SEARCH" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform", "constantName": "org.apache.camel.component.elasti [...] + "CamelElasticsearchId": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "ID of the object to index or retrieve or delete", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#ID" }, + "CamelElasticsearchSearchQuery": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The JSON Query to perform for search", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#SEARCH_QUERY" }, + "CamelElasticsearchIndexSettings": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Advanced - The JSON Index Settings and\/or Mappings Query to perform to create an index", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_SETTINGS" }, + "CamelElasticsearchIndexName": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Index name", "constantName": "org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_NAME" }, + "CamelElasticsearchOperation": { "index": 4, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation", "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", "DELETE_INDEX", "SEARCH" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform", "constantName": "org.apache.came [...] }, "properties": { "clusterName": { "index": 0, "kind": "path", "displayName": "Cluster Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Cluster Name" }, diff --git a/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc b/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc index a5b73117b240..bd219dbda9cf 100644 --- a/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc +++ b/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc @@ -74,14 +74,14 @@ You can set the name of the target index from the `indexName` URI parameter opti You must provide the index id of the content to delete either in the message body, or via a message header with the key `ID` . |`CREATE_INDEX` | |Creates the specified `indexName` and returns a `boolean` value as the message exchange body, indicating whether the operation was successful. -You can set the name of the target index to create from the `indexName` URI parameter option, or by providing a message header with the key `INDEX_NAME`. -You may also provide a header with the key `INDEX_SETTINGS` where the value is a JSON String representation of the index settings. +You can set the name of the target index to create from the `indexName` URI parameter option, or by providing a message header with the key `CamelElasticsearchIndexName`. +You may also provide a header with the key `CamelElasticsearchIndexSettings` where the value is a JSON String representation of the index settings. |`DELETE_INDEX` | |Deletes the specified `indexName` and returns a `boolean` value as the message exchange body, indicating whether the operation was successful. -You can set the name of the target index to create from the `indexName` URI parameter option, or by providing a message header with the key `INDEX_NAME`. +You can set the name of the target index to create from the `indexName` URI parameter option, or by providing a message header with the key `CamelElasticsearchIndexName`. |`SEARCH` |`Map` (optional) |Search for content with either a `Map` of `String` keys & values of query criteria. Or a JSON string representation of the query. Matching documents are returned as a JSON string set on the message exchange body. -You can set the JSON query String by providing a message header with the key `SEARCH_QUERY`. +You can set the JSON query String by providing a message header with the key `CamelElasticsearchSearchQuery`. You can set the message exchange body to a `Map` of `String` keys & values for the query criteria. |=== @@ -104,7 +104,7 @@ To update existing indexed content, provide the `ID` message header and the mess [source,java] ---- from("direct:index") - .setHeader("ID").constant("1") + .setHeader("CamelElasticsearchId").constant("1") .setBody().constant("{\"content\": \"ElasticSearch REST Client With Camel\"}") .to("elasticsearch-rest-client://myCluster?operation=INDEX_OR_UPDATE&indexName=myIndex"); ---- @@ -114,7 +114,7 @@ from("direct:index") [source,java] ---- from("direct:getById") - .setHeader("ID").constant("1") + .setHeader("CamelElasticsearchId").constant("1") .to("elasticsearch-rest-client://myCluster?operation=GET_BY_ID&indexName=myIndex"); ---- @@ -125,7 +125,7 @@ To delete indexed content, provide the `ID` message header. [source,java] ---- from("direct:getById") - .setHeader("ID").constant("1") + .setHeader("CamelElasticsearchId").constant("1") .to("elasticsearch-rest-client://myCluster?operation=DELETE&indexName=myIndex"); ---- @@ -149,7 +149,7 @@ String indexSettings = "{\"settings\":{\"number_of_replicas\": 1,\"number_of_sha [source,java] ---- from("direct:createIndex") - .setHeader("INDEX_SETTINGS").constant(indexSettings) + .setHeader("CamelElasticsearchIndexSettings").constant(indexSettings) .to("elasticsearch-rest-client://myCluster?operation=CREATE_INDEX&indexName=myIndex"); ---- @@ -170,7 +170,7 @@ Search with a JSON query. [source,java] ---- from("direct:search") - .setHeader("SEARCH_QUERY").constant("{\"query\":{\"match\":{\"content\":\"ElasticSearch With Camel\"}}}") + .setHeader("CamelElasticsearchSearchQuery").constant("{\"query\":{\"match\":{\"content\":\"ElasticSearch With Camel\"}}}") .to("elasticsearch-rest-client://myCluster?operation=SEARCH&indexName=myIndex"); ---- diff --git a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticSearchRestClientConstant.java b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticSearchRestClientConstant.java index c5a4623f3160..d1ebaf42a72d 100644 --- a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticSearchRestClientConstant.java +++ b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticSearchRestClientConstant.java @@ -21,21 +21,21 @@ import org.apache.camel.spi.Metadata; public class ElasticSearchRestClientConstant { @Metadata(description = " ID of the object to index or retrieve or delete", javaType = "String") - public static final String ID = "ID"; + public static final String ID = "CamelElasticsearchId"; @Metadata(description = "The JSON Query to perform for search", javaType = "String") - public static final String SEARCH_QUERY = "SEARCH_QUERY"; + public static final String SEARCH_QUERY = "CamelElasticsearchSearchQuery"; @Metadata(description = "Advanced - The JSON Index Settings and/or Mappings Query to perform to create an index", javaType = "String") - public static final String INDEX_SETTINGS = "INDEX_SETTINGS"; + public static final String INDEX_SETTINGS = "CamelElasticsearchIndexSettings"; @Metadata(description = "The Index name", javaType = "String") - public static final String INDEX_NAME = "INDEX_NAME"; + public static final String INDEX_NAME = "CamelElasticsearchIndexName"; @Metadata(description = "The operation to perform", javaType = "org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation") - public static final String OPERATION = "OPERATION"; + public static final String OPERATION = "CamelElasticsearchOperation"; public static final int SOCKET_CONNECTION_TIMEOUT = 30000; public static final int SNIFFER_INTERVAL_AND_FAILURE_DELAY = 60000; diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElasticsearchRestClientEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElasticsearchRestClientEndpointBuilderFactory.java index 7f20c6a328dd..2fb262566a8d 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElasticsearchRestClientEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElasticsearchRestClientEndpointBuilderFactory.java @@ -466,10 +466,10 @@ public interface ElasticsearchRestClientEndpointBuilderFactory { * * Group: producer * - * @return the name of the header {@code ID}. + * @return the name of the header {@code ElasticsearchId}. */ - public String iD() { - return "ID"; + public String elasticsearchId() { + return "CamelElasticsearchId"; } /** * The JSON Query to perform for search. @@ -478,10 +478,10 @@ public interface ElasticsearchRestClientEndpointBuilderFactory { * * Group: producer * - * @return the name of the header {@code SEARCH_QUERY}. + * @return the name of the header {@code ElasticsearchSearchQuery}. */ - public String searchQuery() { - return "SEARCH_QUERY"; + public String elasticsearchSearchQuery() { + return "CamelElasticsearchSearchQuery"; } /** * Advanced - The JSON Index Settings and/or Mappings Query to perform @@ -491,10 +491,10 @@ public interface ElasticsearchRestClientEndpointBuilderFactory { * * Group: producer * - * @return the name of the header {@code INDEX_SETTINGS}. + * @return the name of the header {@code ElasticsearchIndexSettings}. */ - public String indexSettings() { - return "INDEX_SETTINGS"; + public String elasticsearchIndexSettings() { + return "CamelElasticsearchIndexSettings"; } /** * The Index name. @@ -503,10 +503,10 @@ public interface ElasticsearchRestClientEndpointBuilderFactory { * * Group: producer * - * @return the name of the header {@code INDEX_NAME}. + * @return the name of the header {@code ElasticsearchIndexName}. */ - public String indexName() { - return "INDEX_NAME"; + public String elasticsearchIndexName() { + return "CamelElasticsearchIndexName"; } /** * The operation to perform. @@ -516,10 +516,10 @@ public interface ElasticsearchRestClientEndpointBuilderFactory { * * Group: producer * - * @return the name of the header {@code OPERATION}. + * @return the name of the header {@code ElasticsearchOperation}. */ - public String oPERATION() { - return "OPERATION"; + public String elasticsearchOperation() { + return "CamelElasticsearchOperation"; } } static ElasticsearchRestClientEndpointBuilder endpointBuilder(String componentName, String path) {
