# Accessing field values in script processor

**URL:** <https://discuss.elastic.co/t/accessing-field-values-in-script-processor/265048>\
**Category:** Elasticsearch\
**Created:** [February 22, 2021, 9:38am UTC](https://discuss.elastic.co/t/accessing-field-values-in-script-processor/265048 "2021-02-22T09:38:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anabella\_Cristaldi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anabella_cristaldi/32/23612_2.png) [@Anabella\_Cristaldi](https://discuss.elastic.co/u/Anabella_Cristaldi)\
**Post date:** [February 22, 2021, 9:38am UTC](https://discuss.elastic.co/t/accessing-field-values-in-script-processor/265048/1 "2021-02-22T09:38:32Z")

</div>

Hi, I'm studding for the ECE and when reading about script processors to be used in ingestion pipelines I see in the documentation that in order to access the field value I should use the ctx variables

_You can access the current ingest document from within the script context by using the `ctx` variable._

I've tried to use doc values but I've compilation errors, I've tried to access to ctx.\_source and I have runtime errors

My question is why the only way to access fields is using ctx. variable

Thank you!  
Regards  
Ana

---

<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:** [March 22, 2021, 9:38am UTC](https://discuss.elastic.co/t/accessing-field-values-in-script-processor/265048/2 "2021-03-22T09:38:43Z")

</div>

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