How do I use the _id field in Painless?

How do I access the _id field of a document in the Painless scripting language?

Every time I try something like this:

doc['_id'] + "/" + doc['site_code'].value
doc['_index'] + "/" + doc['site_code'].value
ctx.index + "/" + doc['sitecode'].value

All shards crash???

Not very friendly. I'm trying a scripted filed via Kibana with latest hosting plan.

so I managed to access the _id via the _uid field, and applying .substring()

1 Like

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