当前位置: 首页 > news >正文

武汉做网站jw100网址安全中心检测

武汉做网站jw100,网址安全中心检测,永久免费内存大服务器,哪个网站帮别人做ppt基础概念 bucket 数据分组&#xff0c;一些数据按照某个字段进行bucket划分&#xff0c;这个字段值相同的数据放到一个bucket中。可以理解成Java中的Map<String, List>结构&#xff0c;类似于Mysql中的group by后的查询结果。 metric&#xff1a; 对一个数据分组执行…

基础概念

bucket

数据分组,一些数据按照某个字段进行bucket划分,这个字段值相同的数据放到一个bucket中。可以理解成Java中的Map<String, List>结构,类似于Mysql中的group by后的查询结果。

metric:

对一个数据分组执行的统计,比如计算最大值,最小值,平均值等 类似于Mysql中的max(),min(),avg()函数的值,都是在group by后使用的。

案例

以如下文档结构为例:

{"_index" : "zb_notice","_type" : "_doc","_id" : "4451224572914342308301065","_score" : 1.0,"_source" : {"_class" : "NoticeEntity","id" : "111","url" : "https://xxxxxx/purchaseNotice/view/111?","owner" : "河管养所","procurementName" : "工程建筑","procurementNameText" : "应急抢险配套工程建筑","intermediaryServiceMatters" : "无(属于非行政管理的中介服务项目采购)","investmentApprovalProject" : "是","code" : "789456","scale" : 3.167183E8,"scaleText" : "投资额(¥316,718,300.00元)","area" : "","requiredServices" : "工程建筑","typeCodes" : ["021"],"context" : "是一座具有灌溉 、供水 、排洪 、交通和挡潮蓄淡等多功能的大(2)型水闸工程,承担黄冈河下游 8.65 万亩农田的灌溉任务并","timeLimit" : "具体时限以合同条款约定为准。","amount" : 0.0,"amountText" : "暂不做评估与测算","amountDescription" : "","selectIntermediaryType" : "直接选取","isChooseIntermediary" : "否","isAvoidance" : "否","endTime" : "2023-09-04 09:30:00","startTime" : "2023-08-31","files" : [{"fileName" : "东溪水闸初设批复(1).pdf","url" : "/aa/bb/file/downloadfile/PjAttachment/123456"}]}
}

统计服务类型最多公告

GET zb_notice/_search
{"size": 0,"aggs": {"song_qty_by_language": {"terms": {"field": "requiredServices"}}}
}

语法解释:

  • size:0 表示只要统计后的结果,原始数据不展现
  • aggs:固定语法 ,聚合分析都要声明aggs
  • song_qty_by_language:聚合的名称,可以随便写,建议规范命名
  • terms:按什么字段进行分组
  • field:具体的字段名称

响应结果如下:

{"took": 2,"timed_out": false,"_shards": {"total": 5,"successful": 5,"skipped": 0,"failed": 0},"hits": {"total": 5,"max_score": 0,"hits": []},"aggregations": {"song_qty_by_language": {"doc_count_error_upper_bound": 0,"sum_other_doc_count": 0,"buckets": [{"doc_count": 5}]}}
}

语法解释:

  • hits: 由于请求时设置了size:0,hits就是空的
  • aggregations:聚合查询的结果
  • song_qty_by_language:请求时声明的名称
  • buckets:根据指定字段查询后得到的数据分组集合,[]内的是每一个数据分组,其中key为每个bucket的对应指定字段的值,doc_count为统计的数量。

默认按doc_count降序排序。

按服务分类的平均服务价格

GET zb_notice/_search
{"size": 0,"aggs": {"lang": {"terms": {"field": "requiredServices"},"aggs": {"length_avg": {"avg": {"field": "amount"}}}}}
}

这里为两层aggs聚合查询,先按服务类型统计,得到数据分组,再在数据分组里算平均价格。

多个aggs嵌套语法也是如此,aggs代码块的位置即可。

统计最多服务费、最少服务费等的公告

最常用的统计:count,avg,max,min,sum,语法含义与mysql相同。

GET zb_notice/_search
{"size": 0,"aggs": {"color": {"terms": {"field": "requiredServices"},"aggs": {"length_avg": {"avg": {"field": "amount"}},"length_max": {"max": {"field": "amount"}},"length_min": {"min": {"field": "amount"}},"length_sum": {"sum": {"field": "amount"}}}}}
}

按上架日期分段统计服务类型数量

按月统计

date histogram与histogram语法类似,搭配date interval指定区间间隔 extended_bounds表示最大的时间范围。

复制代码GET zb_notice/_search
{"size": 0,"aggs": {"sales": {"date_histogram": {"field": "publishTime","interval": "month","format": "yyyy-MM-dd","min_doc_count": 0,"extended_bounds": {"min": "2023-01-01","max": "2023-12-31"}}}}
}

interval的值可以天、周、月、季度、年等。可以延伸一下

GET zb_notice/_search
{"size": 0,"aggs": {"sales": {"date_histogram": {"field": "publishTime","interval": "quarter","format": "yyyy-MM-dd","min_doc_count": 0,"extended_bounds": {"min": "2019-01-01","max": "2019-12-31"}},"aggs": {"lang_qty": {"terms": {"field": "requiredServices"},"aggs": {"like_sum": {"sum": {"field": "amount"}}}},"total" :{"sum": {"field": "amount"}}}}}
}

带上过滤条件

聚合查询可以和query搭配使用,相当于mysql中where与group by联合使用

查询条件
GET zb_notice/_search
{"size": 0,"query": {"match": {"requiredServices": "工程咨询"}},"aggs": {"sales": {"terms": {"field": "requiredServices"}}}
}
过滤条件
GET zb_notice/_search
{"size": 0,"query": {"constant_score": {"filter": {"term": {"requiredServices": "工程咨询"}}}},"aggs": {"sales": {"terms": {"field": "requiredServices"}}}
}
http://www.hkea.cn/news/883568/

相关文章:

  • 做网站可以赚钱吗百度小说搜索风云排行榜
  • 做网站交接需要哪些权限网站seo视频教程
  • 在网站怎么做收款二维码刷移动关键词优化
  • 问信息奥赛题怎么做 去哪个网站互联网网络推广
  • b2c电子商务网站系统下载专业网站seo推广
  • 引流推广的方法seo诊断工具
  • 平阴县建设工程网站直通车推广怎么做
  • 网站开发外包不给ftp高佣金app软件推广平台
  • 太原适合网站设计地址百度用户服务中心客服电话
  • 济南源码网站建设长沙网站seo推广公司
  • 北京网站制作17页和业务多一样的平台
  • 无锡市住房城乡建设委网站简单网页设计模板html
  • 武汉市大型的网站制作公司网站ip查询
  • 做仪表行业推广有哪些网站电商网站设计
  • 动静分离网站架构百度售后客服电话24小时
  • 做汽车配件生意的网站佛山seo关键词排名
  • 创意建站推荐百度做广告多少钱一天
  • 巴中网站建设公司百度seo怎么做网站内容优化
  • 查网站备案名称上海网络营销seo
  • 人是用什么做的视频网站网络营销方案设计毕业设计
  • 建设网站考虑因素关键词优化是怎么弄的
  • 陕西营销型网站建设推广普通话的内容简短
  • 做配电箱的专门网站百度指数属于行业趋势及人群
  • 学做网站的网站重庆seo整站优化报价
  • 保定网站设计概述seo推广软件排名
  • 查pv uv的网站网络营销推广服务
  • 怎样让客户做网站优化 保证排名
  • 企业营销型网站做的好网络营销的有哪些特点
  • 网站开发 合同兰州快速seo整站优化招商
  • 网站开发技术现状深圳网络营销推广培训