Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-14104 allow setting of HTTP Request Headers for Elasticsearch requests #9606

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,20 @@ public interface ElasticSearchClientService extends ControllerService, Verifiabl
*
* @param operation A document to index.
* @param requestParameters A collection of URL request parameters. Optional.
* @param requestHeaders A collection of request headers. Optional.
* @return IndexOperationResponse if successful
*/
IndexOperationResponse add(IndexOperationRequest operation, Map<String, String> requestParameters);
IndexOperationResponse add(IndexOperationRequest operation, Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Bulk process multiple documents.
*
* @param operations A list of index operations.
* @param requestParameters A collection of URL request parameters. Optional.
* @param requestHeaders A collection of request headers. Optional.
* @return IndexOperationResponse if successful.
*/
IndexOperationResponse bulk(List<IndexOperationRequest> operations, Map<String, String> requestParameters);
IndexOperationResponse bulk(List<IndexOperationRequest> operations, Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Count the documents that match the criteria.
Expand All @@ -282,9 +284,10 @@ public interface ElasticSearchClientService extends ControllerService, Verifiabl
* @param index The index to target.
* @param type The type to target. Will not be used in future versions of Elasticsearch.
* @param requestParameters A collection of URL request parameters. Optional.
* @param requestHeaders A collection of request headers. Optional.
* @return number of documents matching the query
*/
Long count(String query, String index, String type, Map<String, String> requestParameters);
Long count(String query, String index, String type, Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Delete a document by its ID from an index.
Expand All @@ -293,9 +296,10 @@ public interface ElasticSearchClientService extends ControllerService, Verifiabl
* @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.
* @param requestHeaders A collection of request headers. Optional.
* @return A DeleteOperationResponse object if successful.
*/
DeleteOperationResponse deleteById(String index, String type, String id, Map<String, String> requestParameters);
DeleteOperationResponse deleteById(String index, String type, String id, Map<String, String> requestParameters, Map<String, String> requestHeaders);


/**
Expand All @@ -304,9 +308,10 @@ public interface ElasticSearchClientService extends ControllerService, Verifiabl
* @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.
* @param requestHeaders A collection of request headers. Optional.
* @return A DeleteOperationResponse object if successful.
*/
DeleteOperationResponse deleteById(String index, String type, List<String> ids, Map<String, String> requestParameters);
DeleteOperationResponse deleteById(String index, String type, List<String> ids, Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Delete documents by query.
Expand All @@ -315,9 +320,10 @@ public interface ElasticSearchClientService extends ControllerService, Verifiabl
* @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.
* @param requestHeaders A collection of request headers. Optional.
* @return A DeleteOperationResponse object if successful.
*/
DeleteOperationResponse deleteByQuery(String query, String index, String type, Map<String, String> requestParameters);
DeleteOperationResponse deleteByQuery(String query, String index, String type, Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Update documents by query.
Expand All @@ -326,25 +332,29 @@ public interface ElasticSearchClientService extends ControllerService, Verifiabl
* @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.
* @param requestHeaders A collection of request headers. Optional.
* @return An UpdateOperationResponse object if successful.
*/
UpdateOperationResponse updateByQuery(String query, String index, String type, Map<String, String> requestParameters);
UpdateOperationResponse updateByQuery(String query, String index, String type, Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Refresh index/indices.
*
* @param index The index to target, if omitted then all indices will be updated.
* @param requestParameters A collection of URL request parameters. Optional.
* @param requestHeaders A collection of request headers. Optional.
*/
void refresh(final String index, final Map<String, String> requestParameters);
void refresh(final String index, final Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Check whether an index exists.
*
* @param index The index to check.
* @param requestParameters A collection of URL request parameters. Optional.
* @param requestHeaders A collection of request headers. Optional.
* @return true if index exists, false otherwise
*/
boolean exists(final String index, final Map<String, String> requestParameters);
boolean exists(final String index, final Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Check whether a document exists.
Expand All @@ -353,8 +363,10 @@ public interface ElasticSearchClientService extends ControllerService, Verifiabl
* @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.
* @param requestHeaders A collection of request headers. Optional.
* @return true if doc exists in index, false otherwise
*/
boolean documentExists(final String index, final String type, final String id, final Map<String, String> requestParameters);
boolean documentExists(final String index, final String type, final String id, final Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Get a document by ID.
Expand All @@ -363,55 +375,61 @@ public interface ElasticSearchClientService extends ControllerService, Verifiabl
* @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.
* @param requestHeaders A collection of request headers. Optional.
* @return Map if successful, null if not found.
*/
Map<String, Object> get(String index, String type, String id, Map<String, String> requestParameters);
Map<String, Object> get(String index, String type, String id, Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Perform a search using the JSON DSL.
*
* @param query A JSON string reprensenting the query.
* @param query A JSON string representing the query.
* @param index The index to target. Optional.
* @param type The type to target. Optional. Will not be used in future versions of Elasticsearch.
* @param requestParameters A collection of URL request parameters. Optional.
* @param requestHeaders A collection of request headers. Optional.
* @return A SearchResponse object if successful.
*/
SearchResponse search(String query, String index, String type, Map<String, String> requestParameters);
SearchResponse search(String query, String index, String type, Map<String, String> requestParameters, Map<String, String> requestHeaders);

/**
* Retrieve next page of results from a Scroll.
*
* @param scroll A JSON string containing scrollId and optional scroll (keep alive) retention period.
* @param requestHeaders A collection of request headers. Optional.
* @return A SearchResponse object if successful.
*/
SearchResponse scroll(String scroll);
SearchResponse scroll(String scroll, Map<String, String> requestHeaders);

/**
* Initialise a Point in Time for paginated queries.
* Requires Elasticsearch 7.10+ and XPack features.
*
* @param index Index targeted.
* @param keepAlive Point in Time's retention period (maximum time Elasticsearch will retain the PiT between requests). Optional.
* @param requestHeaders A collection of request headers. Optional.
* @return the Point in Time Id (pit_id)
*/
String initialisePointInTime(String index, String keepAlive);
String initialisePointInTime(String index, String keepAlive, Map<String, String> requestHeaders);

/**
* Delete a Point in Time.
* Requires Elasticsearch 7.10+ and XPack features.
*
* @param pitId Point in Time Id to be deleted.
* @param requestHeaders A collection of request headers. Optional.
* @return A DeleteOperationResponse object if successful.
*/
DeleteOperationResponse deletePointInTime(String pitId);
DeleteOperationResponse deletePointInTime(String pitId, Map<String, String> requestHeaders);

/**
* Delete a Scroll.
*
* @param scrollId Scroll Id to be deleted.
* @param requestHeaders A collection of request headers. Optional.
* @return A DeleteOperationResponse object if successful.
*/
DeleteOperationResponse deleteScroll(String scrollId);
DeleteOperationResponse deleteScroll(String scrollId, Map<String, String> requestHeaders);

/**
* Build a transit URL to use with the provenance reporter.
Expand Down
Loading
Loading