Hi,
I am very new to both Elasticsearch and Kibana, which I am using for a current project. I have data coming in from an external source, and one of the fields I have in Discover of Kibana is 'clearancetime'. This field is either empty or has a timestamp in the following format:
January 22nd 2017, 00:00:00.000
I have scripted a field which uses the clearance time in a ternary statement. I think get an error in Discover that the field cleartime used in the expression does not exist in mappings. So I tried adding it via sense with the following PUT request:
PUT source*/_mappings/clearancetime
{
"properties": {
"data": {
"type": "date"
}
}
}
I get back the response : { "acknowledge": true }
But I still get the same field does not exist in mapping error.
Any ideas?
ADDITIONAL ERROR INFORMATION: (sorry about the format)....
Error: Request to Elasticsearch failed: {"error":
{"root_cause":[{"type":"script_exception",
"reason":"Field [clearancetime] used in expression does not exist in mappings"}],
"type":"search_phase_execution_exception","reason":"all shards failed",
"phase":"query","grouped":true,"failed_shards":
[{"shard:0,"index":"source-raw-2017.01","node":"dewddasOSada_0vJWA",
"reason":{"type":"script_exception","reason":"Error during search with inline script
[doc['clearancetime'].value > 0 ? doc['clearancetime'].value - doc['initialtime'].value : 0] using lang [expression]",
"caused_by":{"type":"script_exception",
"reason":"Field [clearancetime] used in expression does not exist in mappings"}}}]}}
The scripted field called "duration" has the following ternary expression:
doc['clearancetime'].value > 0 ? doc['clearancetime'].value - doc['initialtime'].value : 0