Can 'scripted field' in index patterns be used to calculate a value using two existing fields?

I have two timestamp fields in my index and I want to calculate the time difference between two fields using scripted fields, and after that, I want to use fields in the visualization. is this possible?

Hi @lchen, Welcome :wave:

Yes, this is possible: you can use multiple fields from a single document. Please note, that scripted fields are deprecated and runtime fields should be used instead.

You can find some of examples of runtime fields here: Getting started with runtime fields, Elastic’s implementation of schema on read | Elastic Blog

1 Like

i am using an old version so still have script fields instead of run time fields. would this still be possible?

Yes, here you can find some examples: Using Painless in Kibana scripted fields | Elastic Blog

I think you'd need something similar to Combine two string values example.

1 Like

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