# Mapping Data Type using time measures such as \`10ns\`

**URL:** https://discuss.elastic.co/t/mapping-data-type-using-time-measures-such-as-10ns/220036
**Category:** Elasticsearch
**Created:** [February 19, 2020, 5:22pm UTC](https://discuss.elastic.co/t/mapping-data-type-using-time-measures-such-as-10ns/220036 "2020-02-19T17:22:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![stLalo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stlalo/32/61799_2.png) [@stLalo](https://discuss.elastic.co/u/stLalo)
#### Post date: [February 19, 2020, 5:22pm UTC](https://discuss.elastic.co/t/mapping-data-type-using-time-measures-such-as-10ns/220036/1 "2020-02-19T17:22:55Z")

</div>

**Kibana version** :  
7.5.0  
**Elasticsearch version** :  
7.5.0  
**Browser version** :  
Brave latest version

Howdy, y'all!  
**Description** :  
I implemented an ETL pipeline service and a forecasting service using Clojure base on OpenJDK8. I started to work with a profiling library: Tufte by Taoensso. It collects the number of calls to a function and returns running time statistics of the profiled form. Having this data I plan to create a Canvas displaying the information as a table and perhaps graphs. However, I am positive using `text` as datatype would not make my life easier if I would like to make graphs. Anyway, the following is an example of how the library prints to stdout with `System.out.println()`:

```auto
pId nCalls Min 50% ≤ 90% ≤ 95% ≤ 99% ≤ Max Mean MAD Clock Total

:get-s3-event 1 161.00ns 161.00ns 161.00ns 161.00ns 161.00ns 161.00ns 161.00ns ±0% 161.00ns 0%

Accounted 161.00ns 0%
Clock 49.35μs 100%

```

The data looks like the following:

```auto
 {:min 161, 
  :event-name :get-s3-event, 
  :mean 161.0, 
  :p75 161, 
  :mad-sum 0.0,
  :p99 161, :n 1,
  :time "2020-02-19T15:53:35Z",
  :p25 161,
  :p90 161,
  :max 161,
  :mad 0.0,
  :p50 161,
  :sum 161,
  :p95 161}

```

To begin with, I am ignoring the Clock and Account values because I already have Metricbeat and APM doing that for me. However, these numbers aren't detailed enough because it doesn't tell the time measurement. I am like: "161 what?!". Tufte does handle the numbers in its own logic, so if the value is 9e-6, then it is a nanosecond, if the value is 9e-9, then it is ms, etc. Therefore, I pass this hash map over a function that will apply a regex on the string representation (stdout output value) searching for the time measure (m, s, ms, ns, us). Then, finding the matching value, the function will update the values to a string, looking like the following example:

```auto
{:min "161ns", :event-name :get-s3-event, :mean "161.0ns", :p75 "161ns", :mad-sum 0.0, :p99 "161ns", :n 1, :time "2020-02-19T15:53:35Z", :p25 "161ns", :p90 "161ns", :max "161ns", :mad 0.0, :p50 "161ns", :sum "161ns", :p95 "161ns"}

```

I am indexing the modified hash map with string values to Elasticsearch using the mappings data type of `text`. However, maybe I could use a better data type that could help me represent the time duration of `nCalls` and create a Canvas with graphs using duration. What do y'all think?  
[I am using the data type documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html) as reference. I haven't seen anything that could help me or maybe I missed something

---

<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: [March 18, 2020, 5:23pm UTC](https://discuss.elastic.co/t/mapping-data-type-using-time-measures-such-as-10ns/220036/2 "2020-03-18T17:23:01Z")

</div>

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