# Access Source While Making Search Script

**URL:** <https://discuss.elastic.co/t/access-source-while-making-search-script/135294>\
**Category:** Elasticsearch\
**Created:** [June 11, 2018, 6:25am UTC](https://discuss.elastic.co/t/access-source-while-making-search-script/135294 "2018-06-11T06:25:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![panda2004](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panda2004/32/19473_2.png) [@panda2004](https://discuss.elastic.co/u/panda2004)\
**Post date:** [June 11, 2018, 6:25am UTC](https://discuss.elastic.co/t/access-source-while-making-search-script/135294/1 "2018-06-11T06:25:10Z")

</div>

Hey,

Is there a way to access ctx.\_source while making a query/aggregation? I can see [here](https://discuss.elastic.co/t/accessing--source-from-script-search-in-5-0/64358) that it isn't supported in painless (it's only supported while updating by painless). However, according to [this](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html), groovy isn't much supported by now. Is there a workaround?

I have to access the \_source because I have some nested documents which aren't very much access-able only by the doc\_values.

---

<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:** [July 9, 2018, 6:25am UTC](https://discuss.elastic.co/t/access-source-while-making-search-script/135294/2 "2018-07-09T06:25:13Z")

</div>

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