'Access index with Elastic Painless in ingest processor

How can I access a specified Elastic index with Painless from an ingest processor? I haven't been able to find information on this.

Can this then also be tested from Painless Lab in Kibana?

I'm using Elastic 7.12.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source