PutElasticsearchJson 2025.10.9.21

Bundle

org.apache.nifi | nifi-elasticsearch-restapi-nar

Description

An Elasticsearch put processor that uses the official Elastic REST client libraries. Each FlowFile is treated as a document to be sent to the Elasticsearch _bulk API. Multiple FlowFiles can be batched together into each Request sent to Elasticsearch.

Tags

elasticsearch, elasticsearch7, elasticsearch8, elasticsearch9, index, json, put

Input Requirement

REQUIRED

Supports Sensitive Dynamic Properties

false

Properties

PropertyDescription
Batch SizeThe preferred number of FlowFiles to send over in a single batch
Character SetSpecifies the character set of the document data.
Client ServiceAn Elasticsearch client service to use for running queries.
Dynamic TemplatesThe dynamic_templates for the document. Must be parsable as a JSON Object. Requires Elasticsearch 7+
Identifier AttributeThe name of the FlowFile attribute containing the identifier for the document. If the Index Operation is “index”, this property may be left empty or evaluate to an empty value, in which case the document’s identifier will be auto-generated by Elasticsearch. For all other Index Operations, the attribute must evaluate to a non-empty value.
IndexThe name of the index to use.
Index OperationThe type of the operation used to index (create, delete, index, update, upsert)
Log Error ResponsesIf this is enabled, errors will be logged to the NiFi logs at the error log level. Otherwise, they will only be logged if debug logging is enabled on NiFi as a whole. The purpose of this option is to give the user the ability to debug failed operations without having to turn on debug logging.
Max JSON Field String LengthThe maximum allowed length of a string value when parsing a JSON document or attribute.
Output Error ResponsesIf this is enabled, response messages from Elasticsearch marked as “error” will be output to the “error_responses” relationship. This does not impact the output of flowfiles to the “successful” or “errors” relationships
ScriptThe script for the document update/upsert. Only applies to Update/Upsert operations. Must be parsable as JSON Object. If left blank, the FlowFile content will be used for document update/upsert
Scripted UpsertWhether to add the scripted_upsert flag to the Upsert Operation. If true, forces Elasticsearch to execute the Script whether or not the document exists, defaults to false. If the Upsert Document provided (from FlowFile content) will be empty, but sure to set the Client Service controller service’s Suppress Null and Empty Values to Never Suppress or no “upsert” doc will be, included in the request to Elasticsearch and the operation will not create a new document for the script to execute against, resulting in a “not_found” error
Treat Not Found as SuccessIf true, “not_found” Elasticsearch Document associated Records will be routed to the “successful” relationship, otherwise to the “errors” relationship. If Output Error Responses is “true” then “not_found” responses from Elasticsearch will be sent to the error_responses relationship.
TypeThe type of this document (used by Elasticsearch for indexing and searching).

Relationships

NameDescription
errorsRecord(s)/Flowfile(s) corresponding to Elasticsearch document(s) that resulted in an “error” (within Elasticsearch) will be routed here.
failureAll flowfiles that fail for reasons unrelated to server availability go to this relationship.
originalAll flowfiles that are sent to Elasticsearch without request failures go to this relationship.
retryAll flowfiles that fail due to server/cluster availability go to this relationship.
successfulRecord(s)/Flowfile(s) corresponding to Elasticsearch document(s) that did not result in an “error” (within Elasticsearch) will be routed here.

Writes attributes

NameDescription
elasticsearch.put.errorThe error message if there is an issue parsing the FlowFile, sending the parsed document to Elasticsearch or parsing the Elasticsearch response
elasticsearch.bulk.errorThe _bulk response if there was an error during processing the document within Elasticsearch.

See also