Examples for scripted fields in Painless

Continuing the discussion from Handling empty/zero values in Scripted Fields:

:arrow_up: I have been doing some scripted field definition for some Kibana dashboards that I work with for web analytics data.

This Discuss post from 2017 feels like one of the very few examples I am able to find on how to craft scripted fields in Painless. ...am I just poor at searching? I have found all the syntax guides, etc., but I keep thinking somewhere will be a collection of different examples for scripted fields, especially for things like:

  • date formatting examples
  • grabbing an object from an array or JSON doc value
  • string manipulation
  • etc.

Am I missing, like, a repo or documentation page somewhere? If so, I'd love to know!

@elastimatic have you checked the following resources?

https://www.elastic.co/guide/en/elasticsearch/painless/7.6/index.html

Hope that helps.

1 Like

Yes, I did run across that, but I had to dig pretty far in the forums to find an example that fit the bill.

Maybe a wiki or GH repo of examples would be a cool idea...? I would be happy to contribute.

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