Using `ctx` to access source field


#1

What does ctx stand for? I can't find it in the docs.


(Val Crettaz) #2

Depends on the context. Care to tell more?

Here are some uses of the ctx variable:
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-fields.html


#3

I'm just more curious about the name of the variable itself, regardless of use context. Does ctx stand for something? "Something transaction"? Why choose the letters ctx?


#4

Oh wait... context... right?


(Val Crettaz) #5

yes, ctx provides "context" for your scripts


#6

So I'm still somewhat unclear on its need though. Context is just what the values of the document are, right? Wouldn't that be the same as just accessing the doc values?


(system) #7

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