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

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

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"
      }
    }

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