上云无忧 > 文档中心 > 使用BSC(百度流式计算服务)将BOS中的数据导入百度智能云Elasticsearch
Elasticsearch
使用BSC(百度流式计算服务)将BOS中的数据导入百度智能云Elasticsearch

文档简介:
介绍: 本文主要介绍通过 BSC【百度流式计算服务】将数据从BOS【百度对象存储系统】中导入到Es中。 上传数据到BOS: 登录管理控制台,进入BOS产品界面,创建bucket并上传测试文件:
*此产品及展示信息均由百度智能云官方提供。免费试用 咨询热线:400-826-7010,为您提供专业的售前咨询,让您快速了解云产品,助您轻松上云! 微信咨询
  免费试用、价格特惠

介绍

本文主要介绍通过 BSC【百度流式计算服务】将数据从BOS【百度对象存储系统】中导入到Es中。

上传数据到BOS

登录管理控制台,进入BOS产品界面,创建bucket并上传测试文件:

测试文件的内容如下:

编辑BSC 作业

创建BOS Source

进入BSC编辑作业界面,创建bos source table, sql代码如下

CREATE table source_table_bos(
    stringtype STRING,
    longtype LONG
) with(
    type = 'BOS',
    path = 'bos://es-sink-test/test',
    encode = 'json'
);

其中path为上图中红框中指定的bos路径,并在路径前增加"bos://"前缀。

创建Es Sink Table

sql代码如下

create table sink_table_es(
    stringtype String,
    longtype Long
)with(
    type = 'ES',
    es.net.http.auth.user = 'superuser',
    es.net.http.auth.pass = 'bbs_2016',
    es.resource = 'bsc_test_2/doc_type',
    es.clusterId = '296245916518715392',
    es.region = 'bd',
    es.port = '8200',
    es.version = '6.5.3'
);

其中:

  • es.resource对应es的索引与类型,es会在bsc写入数据时自动创建指定索引
  • es.clusterId对应es的集群ID
  • es.region 表示 Es服务所在的地区的代码,可以参考 Es服务区域代码 中查询区域与代码的对应关系。

编写导入语句

sql语句如下:

insert into
	sink_table_es(stringtype, longtype) outputmode append
select
    stringtype,
    longtype
from
    source_table_bos;

保存作业并发布运行作业

查看Es中的数据

相似文档
官方微信
联系客服
400-826-7010
7x24小时客服热线
分享
  • QQ好友
  • QQ空间
  • 微信
  • 微博
返回顶部