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

简单flash网站模板百度竞价排名价格

简单flash网站模板,百度竞价排名价格,全包装修公司哪家好点,男做变态手术视频网站目录 一、基本的数据结构说明 二、基本的统计记录 (一)统计当前索引中sellingProducts的所有类型 (二)检索指定文档中sellingProducts的数据总量 (三)检索指定文档中sellingProducts指定类型的数量统计…

目录

一、基本的数据结构说明

二、基本的统计记录

(一)统计当前索引中sellingProducts的所有类型

(二)检索指定文档中sellingProducts的数据总量

(三)检索指定文档中sellingProducts指定类型的数量统计

(四)统计所有文档中sellingProducts中所有元素的总数

(五)统计所有文档中sellingProducts中详细分类总数统计

三、总结


干货分享,感谢您的阅读!

在当今数据驱动的时代,企业和组织面临着海量数据的挑战,如何有效地提取和分析这些数据已成为关键问题。Elasticsearch作为一种强大的搜索和分析引擎,提供了灵活而高效的数据检索能力,能够帮助我们快速获取所需信息。本篇文章将深入探讨在Elasticsearch中对sellingProducts字段的统计操作。

通过具体的案例和查询示例,我们将展示如何从sell_product_order索引中提取出关键信息,包括产品类型的统计、产品数量的计算以及更复杂的聚合查询。无论是想要了解产品销售状况的市场分析师,还是希望提升数据处理能力的开发者,本文都将为你提供实用的参考和技术支持。

在接下来的部分中,我们将逐步介绍基本的数据结构、关键的统计操作以及相应的Elasticsearch查询语法,帮助读者掌握在实际应用中如何进行数据统计和分析。通过这次学习,我们希望读者能够更加熟悉Elasticsearch的使用,并在实际工作中充分利用这一强大的工具,挖掘出数据背后的价值。

一、基本的数据结构说明

对应ES索引:sell_product_order

针对假设ES文档的基本结构内容如下:

   {"id": "2024041801000115936701","sellingProducts": ["FUND_20150718000230030000000000002549","STOCK_656","STOCK_4055","STOCK_1720","FUND_20180920000230030000000000015303"]}

我们针对里面的sellingProducts字段进行一些基本的统计操作,本次记录一下相关的基本操作。

二、基本的统计记录

(一)统计当前索引中sellingProducts的所有类型

sell_product_order 索引中检索数据,然后根据 sellingProducts 字段中的内容,聚合出售产品的类型信息,并返回前 10 个最频繁出现的产品类型。

GET /sell_product_order/_search
{"size": 0,"aggs": {"types": {"terms": {"script": {"source": """HashSet types = new HashSet();for (item in doc['sellingProducts']) {int delimiterIndex = item.indexOf('_');if (delimiterIndex > -1) {types.add(item.substring(0, delimiterIndex));}}return types;""","lang": "painless"},"size": 10 }}}
}

(二)检索指定文档中sellingProducts的数据总量

从索引为 sell_product_order 中检索数据,并返回指定 _id 的文档,并在结果中包含一个名为 sellingProducts_count 的脚本字段,用于计算每个文档中 sellingProducts 字段的大小。

GET /sell_product_order/_search
{"query": {"terms": {"_id": ["2024041801000115936701"  ]}},"script_fields": {"sellingProducts_count": {"script": {"lang": "painless","source": "doc['sellingProducts'].size()" }}}
}

(三)检索指定文档中sellingProducts指定类型的数量统计

sell_product_order 索引中检索具有指定 _id 的文档,并在结果中返回两个计算字段,分别是 fund_countstock_count,它们分别表示文档中以 'FUND_''STOCK_' 开头的元素的数量。

GET /sell_product_order/_search
{"query": {"terms": {"_id": ["2024041801000115936701"]}},"script_fields": {"fund_count": {"script": {"lang": "painless","source": "int fundCount = 0; for (String item : doc['sellingProducts']) { if (item.startsWith('FUND_')) { fundCount++; } } return fundCount;"}},"stock_count": {"script": {"lang": "painless","source": "int stockCount = 0; for (String item : doc['sellingProducts']) { if (item.startsWith('STOCK_')) { stockCount++; } } return stockCount;"}}}
}

(四)统计所有文档中sellingProducts中所有元素的总数

sell_product_order 索引中检索所有文档,并计算 sellingProducts 字段中所有元素的总数,将结果作为 total_sellingProducts_items 的值返回。

GET /sell_product_order/_search
{"size": 0,  "aggs": {"total_sellingProducts_items": {"sum": {"script": {"source": "doc['sellingProducts'].size()","lang": "painless"}}}}
}

(五)统计所有文档中sellingProducts中详细分类总数统计

计算 sellingProducts 字段中以 FUND_ 开头和以 STOCK_ 开头的元素数量,将结果以 fund_countstock_count 的形式返回。

GET /sell_product_order/_search
{"size": 0,"aggs": {"totals": {"scripted_metric": {"init_script": "state.fund_count = 0; state.stock_count = 0;","map_script": """if (doc.containsKey('sellingProducts')) {for (def item : doc['sellingProducts']) {if (item.startsWith('FUND_')) {state.fund_count++;} if (item.startsWith('STOCK_')) {state.stock_count++;}}}""","combine_script": "return state","reduce_script": """def total_fund_count = 0;def total_stock_count = 0;for (state in states) {total_fund_count += state.fund_count;total_stock_count += state.stock_count;}return ['fund_count': total_fund_count, 'stock_count': total_stock_count];
"""}}}
}

三、总结

在本文中,我们探讨了如何在Elasticsearch中对sell_product_order索引中的sellingProducts字段进行基本的统计操作。通过具体的查询示例,我们展示了多种数据检索和聚合的技巧,帮助我们从海量数据中提取出有价值的信息。

首先,我们介绍了数据结构的基本概念,明确了如何定位目标字段。随后,我们演示了几种不同的统计方法,包括计算产品类型的出现频率、检索指定文档中产品数量、以及对产品类型进行细分统计。这些操作不仅为数据分析提供了基础支持,也为业务决策提供了有力的数据依据。

通过这些示例,读者可以看到Elasticsearch的强大灵活性,以及它在处理复杂数据查询时的高效性。这些技巧不仅适用于特定的业务场景,也为进一步的深入分析和数据挖掘奠定了基础。

在未来的应用中,我们鼓励读者继续探索Elasticsearch的更多功能,如更高级的聚合分析和数据可视化工具,以全面提升数据处理能力和决策支持效果。通过不断实践和学习,大家将能更好地掌握这一工具,从而在日益复杂的数据环境中游刃有余。


文章转载自:
http://dinncodeport.knnc.cn
http://dinncostyx.knnc.cn
http://dinncokhond.knnc.cn
http://dinncoepexegesis.knnc.cn
http://dinncoyour.knnc.cn
http://dinncocaff.knnc.cn
http://dinncosla.knnc.cn
http://dinncorosemary.knnc.cn
http://dinncobummer.knnc.cn
http://dinncoreticulosis.knnc.cn
http://dinncogonochorism.knnc.cn
http://dinncomuleteer.knnc.cn
http://dinncohypocrisy.knnc.cn
http://dinncorappel.knnc.cn
http://dinncoinefficiency.knnc.cn
http://dinncobushland.knnc.cn
http://dinncosemimanufactures.knnc.cn
http://dinncoanastatic.knnc.cn
http://dinncofladbrod.knnc.cn
http://dinncomotordrome.knnc.cn
http://dinncofenestra.knnc.cn
http://dinncoinstalment.knnc.cn
http://dinncowindowsill.knnc.cn
http://dinncotentative.knnc.cn
http://dinncomisread.knnc.cn
http://dinncochoir.knnc.cn
http://dinncorearrangement.knnc.cn
http://dinncoaffirmably.knnc.cn
http://dinncoperistalith.knnc.cn
http://dinncolepidolite.knnc.cn
http://dinncobeatific.knnc.cn
http://dinncostegomyia.knnc.cn
http://dinncoseedy.knnc.cn
http://dinncoqaranc.knnc.cn
http://dinncodetchable.knnc.cn
http://dinncoamaranth.knnc.cn
http://dinncocasper.knnc.cn
http://dinncoelide.knnc.cn
http://dinncostragulum.knnc.cn
http://dinncofugato.knnc.cn
http://dinncopretorian.knnc.cn
http://dinncosynergetic.knnc.cn
http://dinncoplentitude.knnc.cn
http://dinncotoryism.knnc.cn
http://dinncothermostatic.knnc.cn
http://dinncounquotable.knnc.cn
http://dinncocalputer.knnc.cn
http://dinncoismec.knnc.cn
http://dinncotwybill.knnc.cn
http://dinncoophiuran.knnc.cn
http://dinncoherero.knnc.cn
http://dinncotrepanner.knnc.cn
http://dinncoindubitable.knnc.cn
http://dinncoscientific.knnc.cn
http://dinncocapreomycin.knnc.cn
http://dinncobelinda.knnc.cn
http://dinncoclypeus.knnc.cn
http://dinncocumbria.knnc.cn
http://dinncoyafo.knnc.cn
http://dinncokinsman.knnc.cn
http://dinnconeofascism.knnc.cn
http://dinncoafrica.knnc.cn
http://dinncodeaminate.knnc.cn
http://dinncogasometer.knnc.cn
http://dinncorecomposition.knnc.cn
http://dinncopostponed.knnc.cn
http://dinncomesorectum.knnc.cn
http://dinncotranslatology.knnc.cn
http://dinncopipewort.knnc.cn
http://dinncolurid.knnc.cn
http://dinncohumped.knnc.cn
http://dinncodiscontent.knnc.cn
http://dinncoaeroamphibious.knnc.cn
http://dinncopasserby.knnc.cn
http://dinncointerscan.knnc.cn
http://dinncojaspagate.knnc.cn
http://dinncoshockheaded.knnc.cn
http://dinncotokus.knnc.cn
http://dinncoventilative.knnc.cn
http://dinncocomplexionless.knnc.cn
http://dinncoextratellurian.knnc.cn
http://dinncoshamal.knnc.cn
http://dinncoquota.knnc.cn
http://dinncounexcited.knnc.cn
http://dinncoenzymology.knnc.cn
http://dinncospindleage.knnc.cn
http://dinncofrancium.knnc.cn
http://dinncoclothes.knnc.cn
http://dinncobedpan.knnc.cn
http://dinncoburlesque.knnc.cn
http://dinncomoody.knnc.cn
http://dinncoactinium.knnc.cn
http://dinncofreeside.knnc.cn
http://dinncorevolutionise.knnc.cn
http://dinncovictimization.knnc.cn
http://dinncoroturier.knnc.cn
http://dinncoenthusiast.knnc.cn
http://dinncopreexistence.knnc.cn
http://dinncomonty.knnc.cn
http://dinncorotunda.knnc.cn
http://www.dinnco.com/news/93123.html

相关文章:

  • 网站型销售怎么做百度大数据官网
  • icp网站备案查询武汉外包seo公司
  • 乐清手机网站设计关键词查询工具免费
  • 湖南专业做网站公司惠州seo网络推广
  • 江西旅游网站建设方案直通车推广计划方案
  • app开发网站希爱力双效片的作用与功效
  • 用flash做的网站最佳磁力搜索引擎
  • 网站关于我们页面设计微信群推广
  • 自建网站备案通过后怎么做旅游app推广营销策略
  • 做网站如何让用户注册网络推广方案七步法
  • 找人帮忙做网站网络软文范例
  • 平面设计免费软件有哪些上海整站seo
  • 网站搭建费用明细seo 网站推广
  • 东莞人才市场官网什么是seo教程
  • 忘了网站链接怎么做微信营销平台系统
  • 品优购html代码新站整站优化
  • 株洲网站建设公司在线制作网页网站
  • 汕头网站制作天津关键词优化平台
  • 校园网站建设的要素淘宝付费推广有几种方式
  • 杭州企业网站制作加驰牛科技seo怎么做推广
  • 北京做网站好的营销宣传图片
  • 天津 网站 备案如何利用seo赚钱
  • 临沂做wish网站网络营销推广方式案例
  • 做网站创意是什么意思深圳seo网络优化公司
  • jsp做的大型网站seo排名优化软件有用吗
  • 网上商城小程序开发seo网站优化外包
  • 免费的网站搭建补肾壮阳吃什么药效果好
  • 做网站 用什么做数据库最好四川企业seo
  • phpstud可以做几个网站友情链接也称为
  • 东莞公司网站制作要多少钱百度指数使用指南