开发者社区> 问答> 正文

flink无法写入数据到ES中怎么办?

我在使用Flink写入数据到ES中,程序可以执行成功但是ES中没有数据,而且没有任何报错信息我首先创建了一个sink的es表String sql =  "CREATE TABLE es_sink (\n" + "uid INT,\n" +   "appid INT,\n" + "prepage_id INT,\n" +   "page_id INT,\n" + "action_id STRING,\n" +   "page_name STRING,\n" + "action_name STRING,\n" +   "prepage_name STRING,\n" + "stat_time BIGINT,\n" +   "dt DATE,\n" + "PRIMARY KEY (uid) NOT ENFORCED\n" +   ") WITH (\n" + "'connector.type' = 'elasticsearch',\n" +   "'connector.version' = '6',\n" + "'connector.hosts' =  'http://localhost:9200',\n" + "'connector.index' =  'mytest',\n" + "'connector.document-type' = 'user_action',\n"  + "'update-mode' = 'append',\n" +   "'connector.key-null-literal' = 'n/a',\n" +   "'connector.bulk-flush.max-actions' = '1',\n" +   "'format.type' = 'json'\n" + ")";并通过下面查询出数据String sql =  "select 1 as uid,2 as appid,3 as prepage_id,4 as page_id,'5' as  action_id,'6' as page_name,'7' as action_name,'8' as prepage_name,cast(9 as  bigint) as stat_time, cast('2020-11-11' as date) as dt from student limit  1";我的flink版本是1.11.1,es版本是6.2.2有遇到的朋友可以帮助我看一下*来自志愿者整理的flink邮件归档

展开
收起
又出bug了-- 2021-12-02 11:22:50 940 0
1 条回答
写回答
取消 提交回答
  • 你的SQL语句语法有误,请参考:

    https://ci.apache.org/projects/flink/flink-docs-release-1.11/zh/dev/table/connectors/elasticsearch.html

    希望能帮助到你!*来自志愿者整理的FLINK邮件归档

    2021-12-02 14:08:08
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Flink CDC Meetup PPT - 龚中强 立即下载
Flink CDC Meetup PPT - 王赫 立即下载
Flink CDC Meetup PPT - 覃立辉 立即下载