Use the index name in a scripted field

I want to create a scripted field in an index pattern which takes the first word of the index's name and concatenate to it another value.
How can I access the name of the index via painless in the scripted field?
for example:
index name= 'x1-index*'
scripted field=x1+'_'+doc.['some_string'].value

Try this to access the name.

String idxName = doc['_index'].value;

return idxName;

it is working!
thanks

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