Elasticsearch5.0 BreakChange摘要
Lucene版本
6.2.1
常用API变化重点关注
Java api
1 client create方式变更;
2 count api removed;
3 suggest api removed;
4 groovy dependecies changed;
5 geoDistanceQueryBuilder相关变化;
6 highlight api有变化;
7 NodeBuilder 构建方式变化,降低使用频率;
以上是项目中用到的比较多的几个变化;
DSL Queries
1 search_type=count or scan has been removed
2 默认的搜索超过1000个shard copies 会被 拒绝,当然了你可以 设置更大的值 通过配置:action.search.shard_count.limit
3 一个大的变化,fields已经被stored_fields替代了,stored_fields只返回stored的数据,不会再从_source里边获得;
4 5.0之前所有被标注为@Deprecated的API都被删除;
更多内容参见 :https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_50_search_changes.html
Mapping Changes
1 string type 被 text和keyword类型替代了,text可用于全文检索,keyword用于排序、计数、精确查找;
2 数字类型的底层存储结构改变,现在用一个new BKD Tree的数据结构(占用更少的空间、对范围查询速度更快)替代;
3 geo_point fields 底层同样适用 new BKD Tree数据结构;
4 floating fields 默认用float替代了double,满足大多数情况占用更少的空间;
5 一个索引默认最多支持1000个字段,最多有20层嵌套,每个嵌套的对象最多有50个字段;
Setting Changes
1 Indexed Script
script.indexed
has been replaced byscript.stored
- 类似 script.engine.* 的替代品
script.inline
and script.stored
settings已经被移除了,你现在仅仅可以设置script.line: true
or script.stored: true
.REST API Changes
1 _id的大小如果超过512 bytes,请求将被拒绝;
2 node roles 改变成:master、data、ingest、coordinating_only ;
PACKAGING
JVM 参数从 elasticsearch.in.sh 移动到了 jvm.options 里边
Plugins
1 bin/plugin 被 elasticsearch-plugin 替代;
FileSystem Related Changes
Only a subset of index files were open with mmap
on Elasticsearch 2.x. As of Elasticsearch 5.0, all index files will be open with mmap
on 64-bit systems.
While this may increase the amount of virtual memory used by Elasticsearch.
there is nothing to worry about since this is only address space consumption and the actual memory usage of Elasticsearch will stay similar to what it was in 2.x.
Scripts Change
1 The default scripting language for Elasticsearch is now Painless(https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-painless.html)
Painless的优势
对比:
官方Breaking Changes
https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes.html
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步