上一页 1 2 3 4 5 6 7 8 ··· 15 下一页
摘要: 一、基于_mget的批量查询 1、批量查询指定id 1 GET product/_mget 2 { 3 "ids":[2,3] 4 } 2、查询指定id中某些字段 1 GET product/_mget 2 { 3 "docs": [ 4 { 5 "_id": 2, 6 "_source": [ 7 阅读全文
posted @ 2022-02-13 22:42 showMeTheCodes 阅读(184) 评论(0) 推荐(0)
摘要: 一、脚本查询 1、概念:Scripting是es支持的一种专门用于复杂场景下支持自定义编程的强大的脚本功能 2、es5.0之后默认语言是painless 3、 1 #语法:ctx._source.<field-name> ctx可以理解为上下文 2 #将doc为2数据的price属性-1 3 POS 阅读全文
posted @ 2022-02-13 20:30 showMeTheCodes 阅读(294) 评论(0) 推荐(0)
摘要: 一、histogram 1、histogram:直方图、柱状图 2、 1 GET product/_search 2 { 3 "size": 0, 4 "aggs": { 5 "price_histogram": { 6 "histogram": { 7 "field": "price", 8 "i 阅读全文
posted @ 2022-02-11 21:54 showMeTheCodes 阅读(162) 评论(0) 推荐(0)
摘要: 一、基于查询结果的聚合 1、基于query的aggs 1 #价格大于4500的标签进行聚合 2 GET product/_search 3 { 4 "size": 10, 5 "query": { 6 "range": { 7 "price": { 8 "gte": 4500 9 } 10 } 11 阅读全文
posted @ 2022-02-11 18:17 showMeTheCodes 阅读(94) 评论(0) 推荐(0)
摘要: 一、分桶聚合 1、分桶聚合:根据属性进行分桶,把具有某些相同属性的数据放到一起,相当于mysql的group by 举例:JD商城2021年手机销售量,如果采用分桶聚合。可以按照:小米、华为、苹果、其他等品牌进行聚合 2、 1 #统计不同标签的商品数量 2 GET product/_search 3 阅读全文
posted @ 2022-02-11 16:04 showMeTheCodes 阅读(632) 评论(0) 推荐(0)
摘要: 一、自定义分词器 1 #自定义分词器 2 PUT cunstom_analysis 3 { 4 "settings": { 5 "analysis": { 6 "char_filter": { 7 "my_char_filter":{ 字符过滤器,在切词时将指定词语进行替换 8 "type":"ma 阅读全文
posted @ 2022-02-11 09:56 showMeTheCodes 阅读(261) 评论(0) 推荐(0)
摘要: 一、normalization normalization:规范化。在切词之后,包括大小写的转换、去掉语气词停用词(is、an)、单复数的变化 每种分词器的normalization策略不一样,如下图展示 二、char filter char filter:字符过滤器,在切词之前完成操作 1、HTM 阅读全文
posted @ 2022-02-11 07:43 showMeTheCodes 阅读(41) 评论(0) 推荐(0)
摘要: 一、元数据 1、从索引中查询出的结果可以称之为元数据,如下图 2、可以禁止元数据的展示(一般不使用) 使用如下代码查询后,元数据将不再展示 1 GET product/_search 2 { 3 "_source": false, 4 "query": { 5 "match_all": {} 6 } 阅读全文
posted @ 2022-02-10 16:16 showMeTheCodes 阅读(1042) 评论(0) 推荐(0)
摘要: 一、概念 ES中的mapping类似于数据库中的表结构。mapping中包含字段名称、类型、字段使用的分词器、是否评分、是否创建索引等属性 二、查看mapping GET index/_mapping 三、常用数据类型 数字类型:long、integer、short、byte、double、floa 阅读全文
posted @ 2022-02-09 17:47 showMeTheCodes 阅读(404) 评论(0) 推荐(0)
摘要: C 1 #创建索引 2 PUT product 3 #插入数据 4 PUT product/_doc/1 5 { 6 "name": "lyc", 7 "age": 25 8 } R 1 #查询所有索引 2 GET _cat/indices?v 3 #查询指定索引的数据信息 4 GET produc 阅读全文
posted @ 2022-02-09 15:34 showMeTheCodes 阅读(43) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 15 下一页