# Painless syntax doc inconsistancy

**URL:** <https://discuss.elastic.co/t/painless-syntax-doc-inconsistancy/353190>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [February 13, 2024, 4:00pm UTC](https://discuss.elastic.co/t/painless-syntax-doc-inconsistancy/353190 "2024-02-13T16:00:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [February 13, 2024, 4:00pm UTC](https://discuss.elastic.co/t/painless-syntax-doc-inconsistancy/353190/1 "2024-02-13T16:00:21Z")

</div>

It's probably my lack of understanding, but in the [doc](https://www.elastic.co/guide/en/elasticsearch/painless/8.12/painless-statements.html) document fields are sometimes referenced (top of link, in the conditional) as:

> doc[item]

and other times (bottom of the linked page) as

> ctx.\_source.item

It seems the first way never works for me. What is the difference?

I'm reviewing for the exam and all the examples there use the second format.

Thanks

---

<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 12, 2024, 4:00pm UTC](https://discuss.elastic.co/t/painless-syntax-doc-inconsistancy/353190/2 "2024-03-12T16:00:41Z")

</div>

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