Atitit Elasticsearch6之elasticsearch5.x 新特性
目录
1.1. 其实,elasticsearch5.x 和 elasticsearch2.x 并不区别很大。 1
2.2. Other attilax not impt new feature 2
4.5. 4.5 开发中使用JDBC连接Elasticsearch 6
是因为,ELK里之前版本各种很混乱,直接升级到5.0了。
其实,elasticsearch5.x 按理来说是elasticsearch3.x,只是为了跟随ELK整体版本的统一
首先来看看 5.0 里面都引入了哪些新的功能吧。
-
-
-
- 1、首先看看跟性能有关的
- 1.1 第一个就是Lucene 6.x 的支持。
-
-
Elasticsearch5.0率先集成了Lucene6版本,其中最重要的特性就是 Dimensional Point Fields,多维浮点字段,ES里面相关的字段如date, numeric,ip 和 Geospatial 都将大大提升性能
2、我们再看看es在查询优化这块做的工作
-
-
-
- 2.1 新增了一个Profile API。
-
-
#https://www.elastic.co/guide/en/elasticsearch/reference/master/search-profile.html#_usage_3
都说要致富先修路,要调优当然需要先监控啦,elasticsearch在很多层面都提供了stats方便你来监控调优,但是还不够,其实很多情况下查询速度慢很大一部分原因是糟糕的查询引起的,玩过SQL的人都知道,数据库服务的执行计划(execution plan)非常有用,可以看到那些查询走没走索引和执行时间,用来调优,elasticsearch现在提供了Profile API来进行查询的优化,只需要在查询的时候开启profile:true就可以了,一个查询执行过程中的每个组件的性能消耗都能收集到。
像操作Mysql一样使用Elasticsearch,缩减DSL的学习成本,更多人爱上ES的特性。这样我们就可以减少 DSL 的学习成本,这个 SQL 模块是属于 X-Pack 的一部分。
POST /_xpack/sql?format=txt
{
"query": "SELECT * FROM library WHERE release_date < '2000-01-01' "
- Elasticsearch SQL是一个X-Pack组件,它允许针对Elasticsearch实时执行类似SQL的查询。
- 无论是使用REST接口,命令行还是JDBC,任何客户端都可以使用SQL在Elasticsearch中本地搜索和聚合数据。
- 人们可以将Elasticsearch SQL视为翻译工具,简化DSL的复杂使用,方便实时大规模地读取和处理数据。
POST /_xpack/sql?format=txt
{
"query": "SELECT * FROM library ORDER BY page_count DESC LIMIT 5"
}
返回结果:
author | name | page_count | release_date
----------------+---------------+---------------+------------------------
Frank Herbert |Dune |604 |1965-06-01T00:00:00.000Z
James S.A. Corey|Leviathan Wakes|561 |2011-06-02T00:00:00.000Z
Dan Simmons |Hyperion |482 |1989-05-26T00:00:00.000
POST /_xpack/sql/translate
{
"query": "SELECT * FROM library ORDER BY page_count DESC",
"fetch_size": 10
}
返回结果
{
"size": 10,
"_source": {
"includes": [
"author",
"name"
],
"excludes": []
},
"docvalue_fields": [
"page_count",
"release_date"
],
"sort": [
{
"page_count": {
"order": "desc"
}
}
]
String address = "jdbc:es://" + elasticsearchAddress;
Properties connectionProperties = connectionProperties();
Connection connection = DriverManager.getConnection(address, connectionProperties);
try (Statement statement = connection.createStatement();
ResultSet results = statement.executeQuery(
"SELECT name, page_count FROM library ORDER BY page_count DESC LIMIT 1")) {
assertTrue(results.next());
assertEquals("Don Quixote", results.getString(1));
assertEquals(1072, results.getInt(2));
SQLException e = expectThrows(SQLException.class, () -> results.getInt(1));
assertTrue(e.getMessage(), e.getMessage().contains("unable to convert column 1 to an int"));
assertFalse(results.next());
}
Elasticsearch之elasticsearch5.x 新特性 - 大数据和AI躺过的坑 - 博客园.html
Elasticsearch 6 新特性与重要变更解读 - 1.01^365=37.78 (Lucene、ES、ELK开发交流群_ 370734940) - CSDN博客.html
支持SQL Elasticsearch6.3 新特性概览 - qq_18769269的博客 - CSDN博客.html