史上最快! 10小时大数据入门实战(六)- Hadoop 项目实战
1 用户行为日志概述 离线数据处理架构 3 项目需求 4 UserAgent 类实现 使用工具框架 5
@Test
public void testQuery(){
ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
String json = clientUtil.executeHttp("/_xpack/sql?format=txt",
"{\"query\": \"SELECT * FROM dbclobdemo\"}",
ClientInterface.HTTP_POST
);
System.out.println(json);
json = clientUtil.executeHttp("/_xpack/sql?format=json",
"{\"query\": \"SELECT * FROM dbclobdemo\"}",
ClientInterface.HTTP_POST
);
System.out.println(json);
}
public void testTranslate(){
ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
String json = clientUtil.executeHttp("/_xpack/sql/translate",
"{\"query\": \"SELECT * FROM dbclobdemo\"}",
ClientInterface.HTTP_POST
);
System.out.println(json);
}
{
"size": 1000,
"_source": {
"includes": [
"author",
"content",
"docClass",
"docabstract",
"keywords",
"mediapath",
"newpicPath",
"parentDetailTpl",
"picPath",
"publishfilename",
"secondtitle",
"subtitle",
"title",
"titlecolor"
],
"excludes": []
},
"docvalue_fields": [
"auditflag",
"channelId",
"count",
"createtime",
"createuser",
"detailtemplateId",
"docLevel",
"docsourceId",
"doctype",
"documentId",
"docwtime",
"flowId",
"isdeleted",
"isnew",
"ordertime",
"publishtime",
"seq",
"status",
"version"
],
"sort": [
{
"_doc": {
"order": "asc"
}
}
]
}
<properties>
<!--
sql query
-->
<property name="sqlQuery">
<![CDATA[
{"query": "SELECT * FROM dbclobdemo where channelId=#[channelId]"}
]]>
</property>
</properties>
public void testSQLQueryFromDSL(){
ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/sql.xml");//初始化一个加载sql配置文件的es客户端接口
//设置sql查询的参数
Map params = new HashMap();
params.put("channelId",1);
String json = clientUtil.executeHttp("/_xpack/sql","sqlQuery",params,
ClientInterface.HTTP_POST
);
System.out.println(json);//打印检索结果
}
{
"columns": [
{
"name": "auditflag",
"type": "long"
},
{
"name": "author",
"type": "text"
},
{
"name": "channelId",
"type": "long"
},
{
"name": "content",
"type": "text"
},
{
"name": "count",
"type": "long"
},
{
"name": "createtime",
"type": "date"
},
{
"name": "createuser",
"type": "long"
},
{
"name": "detailtemplateId",
"type": "long"
},
{
"name": "docClass",
"type": "text"
},
{
"name": "docLevel",
"type": "long"
},
{
"name": "docabstract",
"type": "text"
},
{
"name": "docsourceId",
"type": "long"
},
{
"name": "doctype",
"type": "long"
},
{
"name": "documentId",
"type": "long"
},
{
"name": "docwtime",
"type": "date"
},
{
"name": "flowId",
"type": "long"
},
{
"name": "isdeleted",
"type": "long"
},
{
"name": "isnew",
"type": "long"
},
{
"name": "keywords",
"type": "text"
},
{
"name": "mediapath",
"type": "text"
},
{
"name": "newpicPath",
"type": "text"
},
{
"name": "ordertime",
"type": "date"
},
{
"name": "parentDetailTpl",
"type": "text"
},
{
"name": "picPath",
"type": "text"
},
{
"name": "publishfilename",
"type": "text"
},
{
"name": "publishtime",
"type": "date"
},
{
"name": "secondtitle",
"type": "text"
},
{
"name": "seq",
"type": "long"
},
{
"name": "status",
"type": "long"
},
{
"name": "subtitle",
"type": "text"
},
{
"name": "title",
"type": "text"
},
{
"name": "titlecolor",
"type": "text"
},
{
"name": "version",
"type": "long"
}
],
"rows": [
[
0,
"不详",
1,
"asdfasdfasdfasdfsdf<img name=\"imgs\" src=\"../gencode7.png\" _ewebeditor_pa_src=\"http%3A%2F%2Flocalhost%2Fcms%2FsiteResource%2Ftest%2F_webprj%2Fgencode7.png\"><br>\r\nasdfasdf<img name=\"imgs\" src=\"content_files/20180505101457109.png\" _ewebeditor_pa_src=\"http%3A%2F%2Flocalhost%2Fcms%2FsiteResource%2Ftest%2F_webprj%2Fnews%2Fcontent_files%2F20180505101457109.png\"><br>\r\n<br>",
0,
"2018-04-12T14:16:02.000Z",
1,
1,
"普通分类",
1,
"无asdfasdf",
1,
0,
1,
"2018-05-06T03:30:04.000Z",
2,
0,
0,
"news",
"uploadfiles/201803/gencode4.png",
"",
"2018-04-12T14:06:45.000Z",
"1",
"uploadfiles/201803/gencode1.png",
"asdf.html",
"2018-04-14T14:36:12.000Z",
"",
0,
11,
"asdf",
"adsf",
"#000000",
1
]
]
}
微信关注我们
转载内容版权归作者及来源网站所有!
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。
为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。
Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。
Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。