# Dynamically cancel processing in pipeline script (painless)

**URL:** <https://discuss.elastic.co/t/dynamically-cancel-processing-in-pipeline-script-painless/99429>\
**Category:** Elasticsearch\
**Created:** [September 5, 2017, 12:53pm UTC](https://discuss.elastic.co/t/dynamically-cancel-processing-in-pipeline-script-painless/99429 "2017-09-05T12:53:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillaume\_S](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@Guillaume\_S](https://discuss.elastic.co/u/Guillaume_S)\
**Post date:** [September 5, 2017, 12:53pm UTC](https://discuss.elastic.co/t/dynamically-cancel-processing-in-pipeline-script-painless/99429/1 "2017-09-05T12:53:54Z")

</div>

Hi,  
I'm working on a file system crawler and indexer, using combination of [FS Crawler](https://github.com/dadoonet/fscrawler) and pipeline (painless scripts) to do transformation/computations on text extracted from documents,  
My question is : is it possible to dynamically cancel or abort processing/indexing of a document based on logic in the pipeline script ?

Thanks,

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [September 9, 2017, 11:25pm UTC](https://discuss.elastic.co/t/dynamically-cancel-processing-in-pipeline-script-painless/99429/2 "2017-09-09T23:25:26Z")

</div>

If you just throw an exception inside the pipeline then it won't index. Also, the error will propagate back to the client, so you need to make sure that the client will ignore the error and won't retry.

---

<div class="post-metadata">

**Author:** ![Guillaume\_S](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@Guillaume\_S](https://discuss.elastic.co/u/Guillaume_S)\
**Post date:** [September 19, 2017, 8:21am UTC](https://discuss.elastic.co/t/dynamically-cancel-processing-in-pipeline-script-painless/99429/3 "2017-09-19T08:21:30Z")

</div>

Hi, thank you for your answer,  
One more precision please : If this failure is in a bulk request, will other document be indexed or all the bulk is in error/discard ?

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [September 19, 2017, 10:03pm UTC](https://discuss.elastic.co/t/dynamically-cancel-processing-in-pipeline-script-painless/99429/4 "2017-09-19T22:03:01Z")

</div>

Only the failed ones will be discarded.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 17, 2017, 10:03pm UTC](https://discuss.elastic.co/t/dynamically-cancel-processing-in-pipeline-script-painless/99429/5 "2017-10-17T22:03:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
