[ 
https://issues.apache.org/jira/browse/NIFI-10687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17623708#comment-17623708
 ] 

Ryan commented on NIFI-10687:
-----------------------------

I have also seen this problem, I was trying to use a PutElasticsearchRecord 
processor in a flow that both updated documents and created new ones, if it was 
updating it would have an attribute with the doc id whereas if it was inserting 
the attribute wouldn't be set. I had to use 2 processors with a route on 
attribute due to the bug above.

> PutElasticsearchRecord/Json incorrectly try to use empty String as document 
> _id
> -------------------------------------------------------------------------------
>
>                 Key: NIFI-10687
>                 URL: https://issues.apache.org/jira/browse/NIFI-10687
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 1.18.0
>            Reporter: Chris Sampson
>            Assignee: Chris Sampson
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{PutElasticsearchRecord}} and {{PutElasticsearchJson}} will try to pass an 
> empty/blank String as the {{_id}} of the document to be created in 
> Elasticsearch if the processor is, for example, configured to use an 
> attribute from the FlowFile or a field from the Record that doesn't exist.
> To re-create:
> * set the ID field to point at a non-existent Field using Expression 
> Language, e.g. {{${notExist}}}
> * input a FlowFile where the attribute/Record Path equates to a non-existent 
> Field (i.e. returns an empty String, but not {{null}})
> * observe that the attempt to send a document to Elasticsearch uses the empty 
> String rather than {{null}}
> Setting the {{_id}} in NiFi to {{null}} in such circumstances would be 
> preferable/expected as this would cause Elasticsearch to auto-generate an 
> {{_id}} when indexing.
> Other NiFi processor fields may also be affected, e.g. for {{@timestamp}} 
> (others should be considered, but some fields should legitimately equate to 
> an empty/blank String and cause an error - {{index}}, for example)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to