Support Questions

Find answers, ask questions, and share your expertise

AttributesToJson into Elasticsearch doesn't work

avatar
Contributor

Hi @ApacheNifi,

i have i extracted the attributes from the filename and used AttributesToJson to create a json file to upload into elasticsearch (to create a catalog).
It gives me many problems, what can I do?
I also noticed that from updateattribute to attributetojson it adds "\ n" in two fields.

This is my flow:

Schermata 2021-01-19 alle 11.45.17.png

 UPDATEATTRIBUTE: I have correctly configured updateattribute and this is the result

 Setting:

Schermata 2021-01-19 alle 11.46.01.png

Result:

Schermata 2021-01-19 alle 11.55.28.png

ATTRIBUTESTOJSON:

Configuration:

Schermata 2021-01-19 alle 11.48.27.png

Result:

Schermata 2021-01-19 alle 12.00.32.png

as you can notice in jsonattributes it adds a "\ n" at the end of the strings "giri" and "id-riduttore" fields

PUTELASTICSEARCHHTTPRECORD:

Configure:

  

Schermata 2021-01-19 alle 11.53.02.png

Schermata 2021-01-19 alle 11.52.57.png

 

Error:

Schermata 2021-01-19 alle 11.52.03.png

How can i do this? thank you so much 

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Lallagreta 
Make sure you do not have any line returns in the values for your dynamic properties added in the UpdateAttribute processor.  When you click on the value field for each property you should not see a line "2".

For example:
Screen Shot 2021-01-21 at 10.03.10 AM.png
Above would result in the value assigned to the FlowFile Attribute having a line return.  If this is the case, edit the properties value(s) to remove the line returns so you only see one line (1).

Hope this helps,

Matt

View solution in original post

2 REPLIES 2

avatar
Expert Contributor

Just asking, what is the result if you change the Property 'Destination' at AttributesToJSON to flowfile-content? 😉😄😄

avatar
Master Mentor

@Lallagreta 
Make sure you do not have any line returns in the values for your dynamic properties added in the UpdateAttribute processor.  When you click on the value field for each property you should not see a line "2".

For example:
Screen Shot 2021-01-21 at 10.03.10 AM.png
Above would result in the value assigned to the FlowFile Attribute having a line return.  If this is the case, edit the properties value(s) to remove the line returns so you only see one line (1).

Hope this helps,

Matt