yuan0122
yuan0122

Reputation: 437

Truncate elastic search hive tables

I am using Elasticsearch Hive integration, so that I can query from Hadoop tables, sending alerts when data is bad (with ElastAlert), as well as display on Kibana.

This is how I created the Elastic table:

CREATE EXTERNAL TABLE my_elastic_table (    
  timestamp BIGINT,   
  count BIGINT  )  
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' 
TBLPROPERTIES('es.resource' = 'my_index/my_type);

And I inserted into Elastic Hive table with:

INSERT OVERWRITE TABLE my_elastic_table
SELECT {something} FROM my_hadoop_table;

However, it didn't really OVERWRITE elastic_table, it actually appended to elastic_table. So I tried to TRUNCATE elastic_table, and it gave me the following error:

FAILED: SemanticException [Error 10146]: Cannot truncate non-managed table elastic_table. 

So I am asking if anyone know how to truncate, update or overwrite Elastic Hive tables. Or is there any better way to deal with this kind of problem. Thank you!

Upvotes: 1

Views: 385

Answers (0)

Related Questions