Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Nifi clear state

avatar

Is there a way to clear the state of a processor using another processor or groovy scripting (in an ExecuteStateProcessor) ?

The goal is to reset the state of a ScrollElasticSearchHttp processor to be able to run it more than once.

Important. I don't want do it manually using the UI ("state management" then "clear state", as it is explained in https://community.hortonworks.com/questions/64405/nifi-clear-state.html)

I want this operation be done after a scroll execution.

Refer the nifi doc : https://help.syncfusion.com/data-integration/processors/scrollelasticsearchhttp

...

Scrolls through an Elasticsearch query using the specified connection properties. This processor is intended to be run on the primary node, and is designed for scrolling through huge result sets, as in the case of a reindex. The state must be cleared before another query can be run.

...

But how do that ?

Thanks by advance.

1 ACCEPTED SOLUTION

avatar
Master Guru

@chauvin christophe

You can use NiFi RestApi /processors/{id}/state/clear-requests call, to clear the state stored in the processor.

We can make restapi call by using invokehttp processor (or) groovy script and triggered by using NiFi.

View solution in original post

3 REPLIES 3

avatar
Master Guru

@chauvin christophe

You can use NiFi RestApi /processors/{id}/state/clear-requests call, to clear the state stored in the processor.

We can make restapi call by using invokehttp processor (or) groovy script and triggered by using NiFi.

avatar

Thank you Shu !

It seems to solve my problem. I can't test it now because of an error when retrieving the state("Failed to obtain value from ZooKeeper for component with ID 8a2d3c3d-5eb5-1331-8be1-6f5fda823456 with exception code CONNECTIONLOSS").

But it's on my side now.

Thanks again.

avatar
New Contributor

@Shu_ashu 
this approach works has a problem that clear-state is working only on stopped processor. 
I am using  ScrollElasticsearch processor and it needs to be cleared before it can be executed again. 
I tried 

 

curl -i -X POST http://localhost:8080/nifi-api/processors/0172101b-be82-11aa-1249-d1383cb1ceba/state/clear-requests

 

 but it end-up with conflict status 
I must stop processor in order to clear-state
Do I really have to stop processor? manually or via API - it doesn't seems to me as a good design.

Could you Help or give any advice please?
Thank u. 

Petr