# Visualisation Painless script between two characters

**URL:** https://discuss.elastic.co/t/visualisation-painless-script-between-two-characters/271296
**Category:** Kibana
**Created:** [April 26, 2021, 8:01pm UTC](https://discuss.elastic.co/t/visualisation-painless-script-between-two-characters/271296 "2021-04-26T20:01:39Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![matw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matw/32/13913_2.png) [@matw](https://discuss.elastic.co/u/matw)
#### Post date: [April 27, 2021, 11:15am UTC](https://discuss.elastic.co/t/visualisation-painless-script-between-two-characters/271296/6 "2021-04-27T11:15:34Z")

</div>

any field calculated when the query is submitted has worse performance. So scripted fields are disabled on [logz.io](http://logz.io)? here's a discuss issue where someone succeeded using the JSON input, didn't test:

> [@JSON Input vs. Scripted Fields](https://discuss.elastic.co/t/json-input-vs-scripted-fields/218788):
>
> Hello, I have a requirement to get the average of the sum of two fields in all document and visualize it, something like this: avg("field 1" + "field 2") I have found two ways to do this and curious what the difference is both in terms of "best practices" or performance: Method 1: Create a "scripted field" for the index which would be the SUM of the two required fields stored into a new field (called sum\_field1\_field2) and get the average of "sum\_field1\_field2 in metric. Method 2: Create a …

However all approaches have this performance drawback.  
Best,  
Matthias

---

_[View the full topic](https://discuss.elastic.co/t/visualisation-painless-script-between-two-characters/271296)._
