搜索和DSL查询的变化node
一、search_type=count参数移除,这个是在2.0版本中已经不推荐使用的了,取而代之的是用查询,size设为0.算法
POST /my_index/_search { "size": 0, "aggs": { "my_terms": { "terms": { "field": "foo" } } } }
二、search_type=scan参数移除,这个是在2.1版本中已经不推荐使用的了。如今滚动请求用_doc排序达到一样的效果。post
POST /my_index/_search?scroll=2m { "sort": [ "_doc" ] }
三、分片查询限制,在1000个之内,由于分片查询会消耗大量的内存和cpu,若是想要绕开这个限制,须要在配置文件中修改参数:action.search.shard_count.limit。ui
3.一、fields参数将被stored_fields参数替换,它只返回存储的字段,将不在从 _source字段中获取。spa
3.二、fielddata_fields参数将被docvalue_fields参数替换。orm
3.三、是否存在接口取消,取而代之的是用查询得到,参数size设为0,terminate_after设置为1。排序
四、查询变化索引
4.一、不支持geo_point的term查询。接口
4.二、fuzzy查询在numeric, date,ip字段中失效,取而代之的是范围查询。ip
4.三、在_uid和_id字段中查询range和prefix将不被支持。
4.四、查询不存在的索引将返回失败,而不是返回no hits。
4.五、在fuzzy查询中将不支持min_similarity参数。
4.六、在query_string查询中将不支持fuzzy_min_sim参数。
4.七、在completion suggester中取消edit_distance参数。
4.八、在索引查询中将不在支持no_match_filter参数。
4.九、在嵌套查询中将不在支持filter字段查询。
4.十、在term查询中将不在支持minimum_should_match和disable_coord,取消了execution参数。
4.十一、在_score查询中取消了top level过滤。
4.十二、在span_near查询中取消了collect_payloads参数。
4.1三、在 nested和has_child查询中取消了score_type参数, has_parent查询中取消了score_mode,同时取消了 total score mode。
4.1四、在has_child查询中max_children参数在之前的版本中设置为0表示没有限制,如今表示0.
4.1五、若是_field_names字段被禁用时, exists查询将返回失败。
4.1六、若是cross_fields,phrase,phrase_prefix类型中有模糊(fuzziness),则multi_match查询将失败。
4.1七、GeoPolygonQuery,GeoDistanceQuery,GeoBoundingBoxQuery查询中coerce, normalize, ignore_malformed参数将失效,用validation_method 参数代替。
4.1八、geo_distance_range 查询将取消,将用geo_distance聚合来代替。
4.1九、在search接口中top level过滤将取消,用post_filter来代替。
4.20、多个高亮显示名称将不被支持,惟一支持的是plain, fvh and postings。
4.2一、term vectors API再也不坚持未映射的字段的映射。DFS参数在term vectors API中已经被彻底删除。
4.2二、reverse参数在排序中将被取消,在validation_method方法中取消coerce和ignore_malformed参数。
4.2三、Top level inner hits语法被取消,inner hits只能在存在nested, has_child,has_parent查询中一部分。
查询分析器:
在profiling查询的返回值中,query_type更名为type,lucene更名为description
搜索偏好:
在搜索偏好_only_node被删除,能够用_only_nodes和指定的node ID来实现。_only_nodes替换了_only_node的功能,_only_node不支持多个节点。preference _shards参数接收用|分来的第二个参数,例如_shards:2,3|_primary。
默认使用BM25评分算法,替换以前的TF/IDF。
fields字段被修改成stored_fields。
本文由赛克 蓝德(secisland)原创,转载请标明做者和出处。