# Date field in elastic hive table is created as text in ES

**URL:** https://discuss.elastic.co/t/date-field-in-elastic-hive-table-is-created-as-text-in-es/95048
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [July 29, 2017, 7:23pm UTC](https://discuss.elastic.co/t/date-field-in-elastic-hive-table-is-created-as-text-in-es/95048 "2017-07-29T19:23:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![aliyesami](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@aliyesami](https://discuss.elastic.co/u/aliyesami)
#### Post date: [July 29, 2017, 7:23pm UTC](https://discuss.elastic.co/t/date-field-in-elastic-hive-table-is-created-as-text-in-es/95048/1 "2017-07-29T19:23:59Z")

</div>

any data that I insert in the hadoop Elasticsearch table in HIVE is being mapped as text .  
I think that's why the date operations are not working on my Index.

> 0: jdbc:hive2://hadoop2:10000/default\> desc pa\_lane\_txn\_es;  
> +---------------------+---------------+--------------------+--+  
> | col\_name | data\_type | comment |  
> +---------------------+---------------+--------------------+--+  
> | txn\_id | bigint | from deserializer |  
> | txn\_process\_date | date | from deserializer |  
> | transp\_id | string | from deserializer |  
> | ext\_plaza\_id | string | from deserializer |  
> | transp\_cur\_bal | decimal(6,0) | from deserializer |  
> | ext\_lane\_id | string | from deserializer |  
> | ext\_date\_time | date | from deserializer |  
> | toll\_amt\_charged | decimal(6,0) | from deserializer |  
> | toll\_amt\_collected | decimal(6,0) | from deserializer |  
> | toll\_amt\_full | decimal(6,0) | from deserializer |  
> | ent\_plaza\_id | string | from deserializer |  
> | ent\_date\_time | date | from deserializer |  
> | ent\_lane\_id | string | from deserializer |  
> +---------------------+---------------+--------------------+--+  
> 13 rows selected (0.055 seconds)
> 
> ```
> "txn_process_date" : {
> "type" : "text",
> "fields" : {
> "keyword" : {
> "type" : "keyword",
> "ignore_above" : 256
> }
>  
> "_index" : "lane_txn",
> "_type" : "txn_id",
> "_id" : "22625326422",
> "_score" : 3.1129305,
> "_source" : {
> "txn_id" : 22625326422,
> "txn_process_date" : "2017-01-02-05:00",
> "transp_id" : "146067200110",
> "ext_plaza_id" : "006431",
> "transp_cur_bal" : "0",
> "ext_lane_id" : "50",
> "ext_date_time" : "2017-01-02-05:00",
> "toll_amt_charged" : "79",
> "toll_amt_collected" : "79",
> "toll_amt_full" : "106",
> "ent_plaza_id" : null,
> "ent_date_time" : null,
> "ent_lane_id" : null
> 
> ```

---

<div class="post-metadata">

### Author: ![aliyesami](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@aliyesami](https://discuss.elastic.co/u/aliyesami)
#### Post date: [July 29, 2017, 8:48pm UTC](https://discuss.elastic.co/t/date-field-in-elastic-hive-table-is-created-as-text-in-es/95048/2 "2017-07-29T20:48:26Z")

</div>

I found the issue , I was creating the elastic hive table with date files as type "DATE" . I changed it to "TIMESTAMP" and now elasticsearch is showing date fields as date and not text.

> ```
> "txn_process_date" : {
> "type" : "date"
> }
> }
> 
> ```

---

<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: [August 26, 2017, 8:48pm UTC](https://discuss.elastic.co/t/date-field-in-elastic-hive-table-is-created-as-text-in-es/95048/3 "2017-08-26T20:48:31Z")

</div>

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