我想将我在hadoop集群中的数据推送到ES,然后在kibana4中可视化这个洞。 这就是我所做的: 1)
CREATE TABLE xx(traffic_type_id INT, caller INT, time STRING, tranche_horaire INT, called INT, call_duration INT, code_type_trafic STRING, code_destination_trafic STRING, location_number STRING, id_offre INT, id_service INT)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t';
LOAD DATA INPATH ‘/user/hive/outt.csv’ OVERWRITE INTO TABLE xx;
2)
CREATE EXTERNAL TABLE esxx (caller INT, time STRING, tranche INT, called_number INT, duration INT, code_type STRING, code_destination STRING, location STRING, offre INT, service INT)
STORED BY ‘org.elasticsearch.hadoop.hive.EsStorageHandler’
TBLPROPERTIES(‘es.resource’ = ‘xx/xx’,
‘es.nodes’=’192.168.238.130:9200′,
‘es.mapping.names’ = ‘time:@timestamp’);
INSERT OVERWRITE TABLE escdr SELECT s.caller, s.time, s.tranche_horaire, s.called, s.call_duration, s.code_type_trafic, s.code_destination_trafic, s.location_number, s.id_offre, s.id_service FROM xx s;
3)
CREATE EXTERNAL TABLE xx (
caller INT,
time TIMESTAMP,
tranche INT,
called_number INT,
duration INT,
code_type STRING,
code_destination STRING,
location STRING,
offre INT,
service INT)
STORED BY ‘org.elasticsearch.hadoop.hive.EsStorageHandler’
TBLPROPERTIES(‘es.resource’ = ‘xx/xx/’,
‘es.nodes’=’192.168.238.130:9200′,
‘es.mapping.names’ = ‘time:@timestamp’);
但Kibana似乎没有认出我的时间戳“时间”,ES继续将其映射为字符串(我的csv文件中的时间字段如下:exp:01AUG2014:19:02:11!我该怎么办?做并改变让ES做适当的映射,从而识别我的时间戳?
致以最诚挚的问候,
奥马,
答案 0 :(得分:0)
如果我是你,我会在导入时将这个奇怪的时间戳格式转换为基本的ISO8601,这样你的时间戳就像2014-08-01T19:02:11Z(或+ HH:MM,无论你有什么时区你的时间;我没办法告诉)。