当我在 ElasticSearch Handler 存储的 hive 中创建外部表时,它可以正常工作:
*CREATE TABLE test (day STRING, idCust STRING)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.resource' = 'test/test',
'es.mapping.names' = 'day:@timestamp',
'es.nodes' = 'localhost');*
当我向其中插入数据时,它起作用了
但是当我尝试查询它时,出现错误:
异常 java.io.IOException 失败:org.elasticsearch.hadoop.EsHadoopIllegalArgumentException:索引 [test/test] 缺失且设置 [es.index.read.missing.as.empty] 设置为 false
当我检查索引列表时,'test' 没有出现
curl 'localhost:9200/_cat/indices?v'
请帮忙
最佳答案
'es.index.auto.create' 默认为 true
只需添加这个
CREATE TABLE test (day STRING, idCust STRING)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.resource' = 'test/test',
'es.mapping.names' = 'day:@timestamp',
'es.nodes' = 'localhost', **'es.index.auto.create' = 'true','es.index.read.missing.as.empty'='yes'**);
我觉得可以解决问题
关于hadoop - hive elasticsearch外部表创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37258795/