Elasticsearch 的 JDBC 驱动 sql4es

码农软件 · 软件分类 · 搜索引擎 · 2019-08-26 07:42:38

软件介绍

sql4es,即 Sql-for-Elasticsearch,是 Elasticsearch 的 JDBC 驱动程序。用于 Elasticsearch 2.0 - 2.4 版本实现大多数 JDBC 接口:Connection、Statement、PreparedStatment、ResultSet、Batch 和 DataBase- / ResultSetMetadata。


用法

可以通过将jar文件(位于项目的releases目录中)添加到所使用的工具/应用中并加载名为 “nl.anchormen.sql4es.jdbc.ESDriver” 的驱动程序来使用 sql4es 驱动。驱动程序需要具有以下格式的URL:jdbc:sql4es:// host:port / index?params。

host:es主机的主机名或ip主机(必需)
port:可选传输客户端使用的端口号(默认为9300)
index:在驱动程序中设置活动的可选索引。
params:用于影响驱动程序内部的可选参数集(指定其他主机,在单个请求中获取的最大文档数等)。

// register the driver and get a connection for index 'myidx'
Class.forName("nl.anchormen.sql4es.jdbc.ESDriver");
Connection con = DriverManager.getConnection("jdbc:sql4es://localhost:9300/myidx?cluster.name=your-cluster-name");
Statement st = con.createStatement();
// execute a query on mytype within myidx
ResultSet rs = st.executeQuery("SELECT * FROM mytype WHERE something >= 42");
ResultSetMetaData rsmd = rs.getMetaData();
int nrCols = rsmd.getColumnCount();
// get other column information like type
while(rs.next()){
    for(int i=1; i<=nrCols; i++){
        System.out.println(rs.getObject(i));
    }
}
rs.close();
con.close();

本文地址:https://codercto.com/soft/d/13187.html

CSS3 For Web Designers

CSS3 For Web Designers

Dan Cederholm / Happy Cog / 2010-11 / $18

From advanced selectors to generated content to the triumphant return of web fonts, and from gradients, shadows, and rounded corners to full-blown animations, CSS3 is a universe of creative possibilit......一起来看看 《CSS3 For Web Designers》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具