hadoop - hive elasticsearch外部表创建

标签 hadoop elasticsearch hive

当我在 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/

相关文章:

elasticsearch - 在ElasticSearch 5中将C#枚举另存为字符串而不是int

apache-spark - 无法使用 Apache Hudi 编写非分区表

hadoop - Apache hive : How to Add Column at Specific Location in Table

hadoop - Sparksession 错误是关于配置单元的

python - 如何使用 Python 获取 hdfs 文件的创建日期

hadoop - 即使查询中存在分区谓词,也找不到 Alias 的分区谓词

python - MapReduce Python - 太多值无法解包

ElasticSearch:过滤深度嵌套的数据

c# - 必须全部满足的NEST复合查询

hadoop - hadoop及其技术设置