# Kibana scripted field error tells me I dont have any values in field while they do show up in discovery

**URL:** <https://discuss.elastic.co/t/kibana-scripted-field-error-tells-me-i-dont-have-any-values-in-field-while-they-do-show-up-in-discovery/256851>\
**Category:** Kibana\
**Created:** [November 27, 2020, 8:40am UTC](https://discuss.elastic.co/t/kibana-scripted-field-error-tells-me-i-dont-have-any-values-in-field-while-they-do-show-up-in-discovery/256851 "2020-11-27T08:40:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skibana](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@skibana](https://discuss.elastic.co/u/skibana)\
**Post date:** [November 27, 2020, 8:40am UTC](https://discuss.elastic.co/t/kibana-scripted-field-error-tells-me-i-dont-have-any-values-in-field-while-they-do-show-up-in-discovery/256851/1 "2020-11-27T08:40:58Z")

</div>

I've been trying to create a scripted field in which i want to make a URL which directs me to a specific APM timeline page. The values I want to add to this URL are filters which are needed to select te specific transaction in APM.

When i try to create this field I keep getting an error telling me there are no values in 2/4 fields.

The error is:

```auto
    {
     "root_cause": [
      {
       "type": "script_exception",
       "reason": "runtime error",
       "script_stack": [
        "org.elasticsearch.index.fielddata.ScriptDocValues$Strings.get(ScriptDocValues.java:496)",
        "org.elasticsearch.index.fielddata.ScriptDocValues$Strings.getValue(ScriptDocValues.java:503)",
        "'https://xxx/xxx/xxx/xxxrangeFrom=now-1h&rangeTo=now&traceId=' + doc['trace.id'].value + '&transactionId=' + doc['transaction.id'].value + '&transactionName=' + doc['transaction.name'].value + '&transactionType=' + doc['transaction.type'].value",
        " ^---- HERE"
       ],
       "script": "'https://xxx/xxx/xxx/xxxrangeFrom=now-1h&rangeTo=now&traceId=' + doc['trace.id'].value + '&transactionId=' + doc['transaction.id'].value + '&transactionName=' + doc['transaction.name'].value + '&transactionType=' + doc['transaction.type'].value",
       "lang": "painless",
       "position": {
        "offset": 184,
        "start": 0,
        "end": 244
       }
      }
     ],
     "type": "search_phase_execution_exception",
     "reason": "Partial shards failure",
     "phase": "fetch",
     "grouped": true,
     "failed_shards": [
      {
       "shard": 0,
       "index": "apm-2020.47-esdec-backend-error-7.8.1",
       "node": "uvVVVbE9RRGTnxaF6_S73g",
       "reason": {
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
         "org.elasticsearch.index.fielddata.ScriptDocValues$Strings.get(ScriptDocValues.java:496)",
         "org.elasticsearch.index.fielddata.ScriptDocValues$Strings.getValue(ScriptDocValues.java:503)",
         "'https://xxx/xxx/xxx/xxxrangeFrom=now-1h&rangeTo=now&traceId=' + doc['trace.id'].value + '&transactionId=' + doc['transaction.id'].value + '&transactionName=' + doc['transaction.name'].value + '&transactionType=' + doc['transaction.type'].value",
         " ^---- HERE"
        ],
        "script": "'https://xxx/xxx/xxx/xxxrangeFrom=now-1h&rangeTo=now&traceId=' + doc['trace.id'].value + '&transactionId=' + doc['transaction.id'].value + '&transactionName=' + doc['transaction.name'].value + '&transactionType=' + doc['transaction.type'].value",
        "lang": "painless",
        "position": {
         "offset": 184,
         "start": 0,
         "end": 244
        },
        "caused_by": {
         "type": "illegal_state_exception",
         "reason": "A document doesn't have a value for a field! Use doc[<field>].size()==0 to check if a document is missing a field!"
        }
       }
      }
     ]

```

When I check in discovery my fields definetly do have values. I can't figure out what the problem is. Anybody has any idea?

---

<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:** [November 30, 2020, 8:36am UTC](https://discuss.elastic.co/t/kibana-scripted-field-error-tells-me-i-dont-have-any-values-in-field-while-they-do-show-up-in-discovery/256851/2 "2020-11-30T08:36:08Z")

</div>

Hi  
maybe it's a mapping problem? could you share the mapping of those fields / index  
Many thx!  
Best,  
Matthias

---

<div class="post-metadata">

**Author:** ![skibana](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@skibana](https://discuss.elastic.co/u/skibana)\
**Post date:** [November 30, 2020, 10:40am UTC](https://discuss.elastic.co/t/kibana-scripted-field-error-tells-me-i-dont-have-any-values-in-field-while-they-do-show-up-in-discovery/256851/3 "2020-11-30T10:40:29Z")

</div>

Hi Matthias!

Thank you for the reply. The fields which are causing the trouble are transaction.type and transaction.name. I get the following mappings:

```
{
  "apm-2020.48-xxxx-error-7.9.2" : {
    "mappings" : {
      "transaction.name" : {
        "full_name" : "transaction.name",
        "mapping" : {
          "name" : {
            "type" : "keyword",
            "fields" : {
              "text" : {
                "type" : "text",
                "norms" : false
              }
            },
            "ignore_above" : 1024
          }
        }
      }
    }
  }

```

and

```
"apm-2020.48-xxxx-transaction-7.9.2" : {
    "mappings" : {
      "transaction.name" : {
        "full_name" : "transaction.name",
        "mapping" : {
          "name" : {
            "type" : "keyword",
            "fields" : {
              "text" : {
                "type" : "text",
                "norms" : false
              }
            },
            "ignore_above" : 1024
          }
        }
      }
    }
  }

```

and

```
"apm-2020.49-xxxx-metric-7.9.2" : {
    "mappings" : {
      "transaction.type" : {
        "full_name" : "transaction.type",
        "mapping" : {
          "type" : {
            "type" : "keyword",
            "ignore_above" : 1024
          }
        }
      }
    }
  }

```

These are the few I got from the administrator atm. He told me there were a lot though. Is this enough information?

Kind regards,

Sam

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 28, 2020, 10:40am UTC](https://discuss.elastic.co/t/kibana-scripted-field-error-tells-me-i-dont-have-any-values-in-field-while-they-do-show-up-in-discovery/256851/4 "2020-12-28T10:40:40Z")

</div>

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