diff --git a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/DeleteOperationResponse.java b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/DeleteOperationResponse.java
index 13e2aa335e..a9dd13cf5f 100644
--- a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/DeleteOperationResponse.java
+++ b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/DeleteOperationResponse.java
@@ -17,13 +17,14 @@
package org.apache.nifi.elasticsearch;
-public class DeleteOperationResponse {
+public class DeleteOperationResponse implements OperationResponse {
private final long took;
public DeleteOperationResponse(final long took) {
this.took = took;
}
+ @Override
public long getTook() {
return took;
}
diff --git a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java
index d232f2bca9..d186306516 100644
--- a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java
+++ b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java
@@ -26,7 +26,6 @@ import org.apache.nifi.expression.ExpressionLanguageScope;
import org.apache.nifi.processor.util.StandardValidators;
import org.apache.nifi.ssl.SSLContextService;
-import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -83,6 +82,11 @@ public interface ElasticSearchClientService extends ControllerService {
.defaultValue("60000")
.addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
.build();
+ /**
+ * @deprecated this setting is no longer used and will be removed in a future version.
+ * Property retained for now to prevent existing Flows with this processor from breaking upon upgrade.
+ */
+ @Deprecated
PropertyDescriptor RETRY_TIMEOUT = new PropertyDescriptor.Builder()
.name("el-cs-retry-timeout")
.displayName("Retry timeout")
@@ -119,71 +123,85 @@ public interface ElasticSearchClientService extends ControllerService {
* Index a document.
*
* @param operation A document to index.
+ * @param requestParameters A collection of URL request parameters. Optional.
* @return IndexOperationResponse if successful
- * @throws IOException thrown when there is an error.
*/
- IndexOperationResponse add(IndexOperationRequest operation);
+ IndexOperationResponse add(IndexOperationRequest operation, Map requestParameters);
/**
* Bulk process multiple documents.
*
* @param operations A list of index operations.
+ * @param requestParameters A collection of URL request parameters. Optional.
* @return IndexOperationResponse if successful.
- * @throws IOException thrown when there is an error.
*/
- IndexOperationResponse bulk(List operations);
+ IndexOperationResponse bulk(List operations, Map requestParameters);
/**
* Count the documents that match the criteria.
*
* @param query A query in the JSON DSL syntax
* @param index The index to target.
- * @param type The type to target.
- * @return
+ * @param type The type to target. Will not be used in future versions of Elasticsearch.
+ * @param requestParameters A collection of URL request parameters. Optional.
+ * @return number of documents matching the query
*/
- Long count(String query, String index, String type);
+ Long count(String query, String index, String type, Map requestParameters);
/**
* Delete a document by its ID from an index.
*
* @param index The index to target.
- * @param type The type to target. Optional.
+ * @param type The type to target. Optional. Will not be used in future versions of Elasticsearch.
* @param id The document ID to remove from the selected index.
+ * @param requestParameters A collection of URL request parameters. Optional.
* @return A DeleteOperationResponse object if successful.
*/
- DeleteOperationResponse deleteById(String index, String type, String id);
+ DeleteOperationResponse deleteById(String index, String type, String id, Map requestParameters);
/**
* Delete multiple documents by ID from an index.
* @param index The index to target.
- * @param type The type to target. Optional.
+ * @param type The type to target. Optional. Will not be used in future versions of Elasticsearch.
* @param ids A list of document IDs to remove from the selected index.
+ * @param requestParameters A collection of URL request parameters. Optional.
* @return A DeleteOperationResponse object if successful.
- * @throws IOException thrown when there is an error.
*/
- DeleteOperationResponse deleteById(String index, String type, List ids);
+ DeleteOperationResponse deleteById(String index, String type, List ids, Map requestParameters);
/**
* Delete documents by query.
*
* @param query A valid JSON query to be used for finding documents to delete.
* @param index The index to target.
- * @param type The type to target within the index. Optional.
+ * @param type The type to target within the index. Optional. Will not be used in future versions of Elasticsearch.
+ * @param requestParameters A collection of URL request parameters. Optional.
* @return A DeleteOperationResponse object if successful.
*/
- DeleteOperationResponse deleteByQuery(String query, String index, String type);
+ DeleteOperationResponse deleteByQuery(String query, String index, String type, Map requestParameters);
+
+ /**
+ * Update documents by query.
+ *
+ * @param query A valid JSON query to be used for finding documents to update.
+ * @param index The index to target.
+ * @param type The type to target within the index. Optional. Will not be used in future versions of Elasticsearch.
+ * @param requestParameters A collection of URL request parameters. Optional.
+ * @return An UpdateOperationResponse object if successful.
+ */
+ UpdateOperationResponse updateByQuery(String query, String index, String type, Map requestParameters);
/**
* Get a document by ID.
*
* @param index The index that holds the document.
- * @param type The document type. Optional.
+ * @param type The document type. Optional. Will not be used in future versions of Elasticsearch.
* @param id The document ID
+ * @param requestParameters A collection of URL request parameters. Optional.
* @return Map if successful, null if not found.
- * @throws IOException thrown when there is an error.
*/
- Map get(String index, String type, String id);
+ Map get(String index, String type, String id, Map requestParameters);
/**
* Perform a search using the JSON DSL.
diff --git a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationRequest.java b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationRequest.java
index be79416cdf..07cdb3cad1 100644
--- a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationRequest.java
+++ b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationRequest.java
@@ -21,8 +21,9 @@ import java.util.Arrays;
import java.util.Map;
/**
- * A POJO that represents an "operation on an index." It should not be confused with just indexing documents, as it
+ * A POJO that represents an "operation on an index". It should not be confused with just indexing documents, as it
* covers all CRUD-related operations that can be executed against an Elasticsearch index with documents.
+ * Type is optional and will not be used in future versions of Elasticsearch.
*/
public class IndexOperationRequest {
private final String index;
diff --git a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationResponse.java b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationResponse.java
index 8d19ca8972..5aa390640a 100644
--- a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationResponse.java
+++ b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationResponse.java
@@ -23,7 +23,7 @@ import java.io.IOException;
import java.util.List;
import java.util.Map;
-public class IndexOperationResponse {
+public class IndexOperationResponse implements OperationResponse {
private final long took;
private boolean hasErrors;
private List
+
+ The index, operation and (optional) type fields are configured with default values that can be overridden using
+ record path operations that find an index or type value in the record set.
+ The ID and operation type (create, index, update, upsert or delete) can also be extracted in a similar fashion from
+ the record set. The following is an example of a document exercising all of these features:
+
+
+ {
+ "metadata": {
+ "id": "12345",
+ "index": "test",
+ "type": "message",
+ "operation": "index"
+ },
+ "message": "Hello, world",
+ "from": "john.smith"
+ }
+
+
+ {
+ "metadata": {
+ "id": "12345",
+ "index": "test",
+ "type": "message",
+ "operation": "delete"
+ }
+ }
+
+The record path operations below would extract the relevant data:
+
+ - /metadata/id
+ - /metadata/index
+ - metadata/type
+ - metadata/operation
+
+Valid values for "operation" are:
+
+ - create
+ - delete
+ - index
+ - update
+ - upsert
+