# Data type is showing as text value in data view rather than decimal when uploaded using mysql config file by logstash

**URL:** <https://discuss.elastic.co/t/data-type-is-showing-as-text-value-in-data-view-rather-than-decimal-when-uploaded-using-mysql-config-file-by-logstash/306078>\
**Category:** Logstash\
**Created:** [June 1, 2022, 5:49am UTC](https://discuss.elastic.co/t/data-type-is-showing-as-text-value-in-data-view-rather-than-decimal-when-uploaded-using-mysql-config-file-by-logstash/306078 "2022-06-01T05:49:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshay\_bhardwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akshay_bhardwaj/32/106428_2.png) [@akshay\_bhardwaj](https://discuss.elastic.co/u/akshay_bhardwaj)\
**Post date:** [June 1, 2022, 5:49am UTC](https://discuss.elastic.co/t/data-type-is-showing-as-text-value-in-data-view-rather-than-decimal-when-uploaded-using-mysql-config-file-by-logstash/306078/1 "2022-06-01T05:49:20Z")

</div>

Hi i create a sql connection using logstash and upload a data but my data is showing as text as shown in figure.

 ![Screenshot from 2022-06-01 11-18-15](https://us1.discourse-cdn.com/elastic/original/3X/1/4/1416bb454d550208b7d2b00c6dff31c18df07406.png)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [June 1, 2022, 5:59am UTC](https://discuss.elastic.co/t/data-type-is-showing-as-text-value-in-data-view-rather-than-decimal-when-uploaded-using-mysql-config-file-by-logstash/306078/2 "2022-06-01T05:59:43Z")

</div>

Hi @akshay_bhardwaj Welcome to the communinty.

That is because you have not created a mapping (think schema) and so Elasticsearch created the default one for you and chose the default `text` and `keyword` field data types

You should probably take a look at the mapping docs [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html)

Numbers found [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html)

And templates [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html)...

But you could clean up your index and try this..

```auto
PUT performance 
{
  "mappings": {
    "properties": {
      "timedifference": {
        "type": "float"
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![akshay\_bhardwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akshay_bhardwaj/32/106428_2.png) [@akshay\_bhardwaj](https://discuss.elastic.co/u/akshay_bhardwaj)\
**Post date:** [June 1, 2022, 6:05am UTC](https://discuss.elastic.co/t/data-type-is-showing-as-text-value-in-data-view-rather-than-decimal-when-uploaded-using-mysql-config-file-by-logstash/306078/3 "2022-06-01T06:05:49Z")

</div>

Can you please let me know how i change it here my config file

input {

jdbc {

```
jdbc_connection_string => " ***** ;"
# The user we wish to execute our statement as
jdbc_user => " *****"
jdbc_password => " ********"
# The path to our downloaded jdbc driver
jdbc_driver_library => " ********
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
schedule => "* * * * *"
# our query
statement => "SELECT TOP (1000) [client_id]
  ,[client_name]
  ,[tolerance_min]
  ,[tolerance_max]
  ,[TimeFrom]
  ,[TimeTo]
  ,[no_of_persons]
  ,[shift_wise_contracted_hrs] 
  ,[employee_id]
  ,[employee_code]
  ,[employee_name]
  ,[designation]
  ,[INN]
  ,[OUT]
  ,[TimeDifference]
  ,[image_name]
  ,concat('perp-',[id]) uId
  ,'performed' itype
  ,[qrCode_id]
  ,[geo_coordinates]

```

FROM [GMS\_GLOBAL\_DEV].[dev].[ContPerfss]"  
}  
}  
filter {  
Elasticsearch {

```
user => logstash_user
password => test1234

```

}  
}  
output {

Elasticsearch {  
"hosts" =\> "localhost:9200"  
"index" =\> "check"  
"document\_id" =\> "%{uid}"  
}  
stdout { codec =\> rubydebug }  
}

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [June 1, 2022, 6:13am UTC](https://discuss.elastic.co/t/data-type-is-showing-as-text-value-in-data-view-rather-than-decimal-when-uploaded-using-mysql-config-file-by-logstash/306078/4 "2022-06-01T06:13:09Z")

</div>

It is not part of that logstash configuration you need to create a mapping **before** you start loading data from your database.

The command I showed you you can run it in Kibana -\> Dev Tools

The proper Overall Steps are (you went directly to step 2)

1. Create a Mapping / Index Template (this is the schema for your data in Elasticsearch I linked the docs and gave you a sample)
2. Configure and Run Logstash
3. Investigate Data in Discover

You could clean up the data and try the `convert` filter in logstash to set `timedifference` to type float but you will need to delete the index and try again.

> **[Mutate filter plugin | Logstash Reference \[8.2\] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-convert)**

But in my opinion the best approach is to create a mapping

---

<div class="post-metadata">

**Author:** ![akshay\_bhardwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akshay_bhardwaj/32/106428_2.png) [@akshay\_bhardwaj](https://discuss.elastic.co/u/akshay_bhardwaj)\
**Post date:** [June 1, 2022, 6:22am UTC](https://discuss.elastic.co/t/data-type-is-showing-as-text-value-in-data-view-rather-than-decimal-when-uploaded-using-mysql-config-file-by-logstash/306078/5 "2022-06-01T06:22:16Z")

</div>

Thanks Stephen for the solution i done it with your opinion of create mapping.

---

<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:** [June 29, 2022, 6:22am UTC](https://discuss.elastic.co/t/data-type-is-showing-as-text-value-in-data-view-rather-than-decimal-when-uploaded-using-mysql-config-file-by-logstash/306078/6 "2022-06-29T06:22:59Z")

</div>

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