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

网网站建设东莞网站推广营销网站设计

网网站建设,东莞网站推广营销网站设计,乐陵市,那个网站专做地质基础信息一、前言 上篇文章我们学习了ES的搜索辅助功能的一部分–分别是指定搜索返回的字段,搜索结果计数,分页,那么本次我们来学习一下ES的性能分析相关功能。 二、ES性能分析 在使用ES的过程中,有的搜索请求的响应比较慢,…

一、前言

上篇文章我们学习了ES的搜索辅助功能的一部分–分别是指定搜索返回的字段,搜索结果计数,分页,那么本次我们来学习一下ES的性能分析相关功能。

二、ES性能分析

在使用ES的过程中,有的搜索请求的响应比较慢,大部分原因的是DSL的执行逻辑有问题。ES提供了profile功能,该功能详细地列出例如了搜索时每一个步骤的耗时,可以帮助用户对DSL的性能进行剖析。以下将开启profilefile功能:

GET /hotel/_search
{"profile":"true","query": {"match": {"amenities": "充电"}}
}

执行以上DSL后ES返回了一段比较冗长的信息,下面是省略一些信息的返回数据:

{"took" : 11,"timed_out" : false,"_shards" : {...},"hits" : {...},"profile" : {"shards" : [{"id" : "[ER773I31Sx-wJuJwJCh7Ng][hotel][0]","searches" : [{"query" : [{ //在amenities搜索"充电",被ES拆分成两个子查询"type" : "BooleanQuery","description" : "amenities:充 amenities:电","time_in_nanos" : 2365600,  //match搜索的总耗时"breakdown" : {"set_min_competitive_score_count" : 0,"match_count" : 4,  //命中的文档个数"shallow_advance_count" : 0,"set_min_competitive_score" : 0,"next_doc" : 22200,"match" : 4600,"next_doc_count" : 8,"score_count" : 4,  //打分的文档个数"compute_max_score_count" : 0,"compute_max_score" : 0,"advance" : 77800,"advance_count" : 1,"score" : 15600,"build_scorer_count" : 2,"create_weight" : 289900,"shallow_advance" : 0,"create_weight_count" : 1,"build_scorer" : 1955500},"children" : [   //子查询{  //子查询"amenities:充""type" : "TermQuery","description" : "amenities:充","time_in_nanos" : 125800,  //耗时"breakdown" : {...}},{  //子查询"amenities:电""type" : "TermQuery","description" : "amenities:电","time_in_nanos" : 29000,"breakdown" : {...}]}],"rewrite_time" : 16500,"collector" : [   //ES手机数据性能剖析{"name" : "SimpleTopScoreDocCollector","reason" : "search_top_hits","time_in_nanos" : 31900  //ES收集数据的耗时}]}],"aggregations" : [ ]  //聚合性能剖析,本次搜索无聚合,因此数据为空}]}
}

如上所示,在带有profile的返回信息中,除了包含搜索结果外,还包含profile子句,在该子句中展示了搜索过程中各个环节的名称及耗时情况。需要注意的是,使用profile功能是有资源损耗的,建议用户只在前期调试的时候使用该功能,在生产中不要开启profile功能
在java客户端中,我们可以通过SearchSourceBuilder.profile(true)开启profile性能分析。
因为一个搜索可能会跨越多个分片,所以使用shards数组放在profile子句中。每个shard子句中包含3个元素,分别是id、searches和aggregations。

  • id表示分片的唯一标识,它的组成形式为[nodeID][indexName][shardID].
  • searches以数组的形式存在,因为有的搜索请求会跨多个索引进行搜索。每一个search子元素即为在同一个索引中的子查询,此处不仅返回了该search子元素耗时为2365600ns的信息,而且还返回了搜索"充电"的详细策略,即被拆分成"amenities:充"和"amenities:电"两个子查询。同理,children子元素给出了"amenities:充"和"amenities:电"的耗时和详细搜索步骤的耗时,此处不再赘述。
  • aggregations只有在进行聚合运算时才有内容,这个之后学习聚合的时候会再次提及

上面只是一个很简单的例子,如果查询比较复杂或者命中的分片比较多,profile返回的信息将特别冗长。在这种情况下,用户进行性能剖析的效率将非常低。为此,Kibana提供了可视化的profile功能,该功能建立在ES的profile功能基础上。在Kibana的DEV Tools界面中单击Search Profiler链接,就可以使用可视化的profile了,输入刚才在控制台输入的DSL,其区域布局如下图:
在这里插入图片描述

三、ES评分分析

在使用搜索引擎时,一般都会涉及排序功能,如果用户不指定按照某个字段进行升序或者降序排列,那么ES会使用自己的打分算法对文档进行排序。有时我们需要知道某个文档的具体的打分详情,以便于对搜索DSL问题进行排查。ES提供了explain功能来帮助使用者查看搜索时的匹配详情。explain的使用形式如下:

GET /${index_name}/_explain/${doc_id}
{"query": {...}
}

以下示例为按照标题进行搜索的explain查询请求:

GET /hotel/_explain/002
{"query": {"match": {"amenities": "充电"}}
}

执行上述explain查询请求后,ES返回信息如下:

{"_index" : "hotel","_type" : "_doc","_id" : "002","matched" : true,"explanation" : {    //"amenities": "充电"被拆分成两个子查询"value" : 0.56802404,"description" : "sum of:","details" : [{  //子查询"amenities": "充"的具体匹配过程"value" : 0.28401202,    "description" : "weight(amenities:充 in 6) [PerFieldSimilarity], result of:","details" : [{"value" : 0.28401202,  //子查询"amenities": "充"的匹配得分"description" : "score(freq=1.0), computed as boost * idf * tf from:","details" : [...,...,...]}]},{  //子查询"amenities": "电"的具体匹配过程"value" : 0.28401202,"description" : "weight(amenities:电 in 6) [PerFieldSimilarity], result of:","details" : [{  "value" : 0.28401202,  //子查询"amenities": "电"的匹配得分"description" : "score(freq=1.0), computed as boost * idf * tf from:","details" : [...,...,...]}]}]}]}
}

上面的内容将返回结果省略了,可以看到,explain返回的信息比较全面,关于每一项内容在之后的篇章中会进行讲解。
另外,如果一个文档和查询不匹配,explain也会直接将返回信息告知用户,具体如下:

{"_index" : "hotel",  //搜索的索引"_type" : "_doc","_id" : "002","matched" : false,   //没有命中的文档"explanation" : {"value" : 0.0,"description" : "no matching term","details" : [ ]   //命中的文档集合为空}
}

文章转载自:
http://dinncomeloid.tqpr.cn
http://dinncointerscapular.tqpr.cn
http://dinncodimidiation.tqpr.cn
http://dinncosubcolumnar.tqpr.cn
http://dinncokue.tqpr.cn
http://dinncopediarchy.tqpr.cn
http://dinncotorc.tqpr.cn
http://dinncoricer.tqpr.cn
http://dinncohedonics.tqpr.cn
http://dinncowhither.tqpr.cn
http://dinncoboutique.tqpr.cn
http://dinncofluonomist.tqpr.cn
http://dinncogeoethnic.tqpr.cn
http://dinncoflowering.tqpr.cn
http://dinncotonality.tqpr.cn
http://dinncoantiperspirant.tqpr.cn
http://dinncolatent.tqpr.cn
http://dinncocaracul.tqpr.cn
http://dinncotmv.tqpr.cn
http://dinncowalkabout.tqpr.cn
http://dinncoprickspur.tqpr.cn
http://dinncoaerobiosis.tqpr.cn
http://dinncoinvolvement.tqpr.cn
http://dinncotandem.tqpr.cn
http://dinncoprimates.tqpr.cn
http://dinncooverlook.tqpr.cn
http://dinncobluenose.tqpr.cn
http://dinncomoneywort.tqpr.cn
http://dinncooptional.tqpr.cn
http://dinncoasynchronism.tqpr.cn
http://dinncotrichi.tqpr.cn
http://dinncocognizant.tqpr.cn
http://dinncofeebleminded.tqpr.cn
http://dinncouhlan.tqpr.cn
http://dinncosplenium.tqpr.cn
http://dinncomart.tqpr.cn
http://dinncocalomel.tqpr.cn
http://dinncophonate.tqpr.cn
http://dinncocommensalism.tqpr.cn
http://dinncosuzhou.tqpr.cn
http://dinncoharmonical.tqpr.cn
http://dinncowoolman.tqpr.cn
http://dinncopantalets.tqpr.cn
http://dinncosephadex.tqpr.cn
http://dinncopeloponnesus.tqpr.cn
http://dinncotangelo.tqpr.cn
http://dinncothicken.tqpr.cn
http://dinncogestagen.tqpr.cn
http://dinnconubecula.tqpr.cn
http://dinncoeverywhither.tqpr.cn
http://dinncode.tqpr.cn
http://dinncocancrine.tqpr.cn
http://dinncolockup.tqpr.cn
http://dinncoborehole.tqpr.cn
http://dinncorecon.tqpr.cn
http://dinncocomplier.tqpr.cn
http://dinncodumbstruck.tqpr.cn
http://dinnconantes.tqpr.cn
http://dinncoconcuss.tqpr.cn
http://dinnconabbie.tqpr.cn
http://dinncoverbosely.tqpr.cn
http://dinncoamitrol.tqpr.cn
http://dinncohaematidrosis.tqpr.cn
http://dinncomicrococcic.tqpr.cn
http://dinncoforedeck.tqpr.cn
http://dinncoradiothermy.tqpr.cn
http://dinncohexapodous.tqpr.cn
http://dinncozoolater.tqpr.cn
http://dinncodignified.tqpr.cn
http://dinncofelipa.tqpr.cn
http://dinncoprovencal.tqpr.cn
http://dinncograma.tqpr.cn
http://dinnconipa.tqpr.cn
http://dinncolangton.tqpr.cn
http://dinncohillel.tqpr.cn
http://dinncofretted.tqpr.cn
http://dinncocubature.tqpr.cn
http://dinncorevulsion.tqpr.cn
http://dinncocine.tqpr.cn
http://dinncoappulse.tqpr.cn
http://dinncoovermark.tqpr.cn
http://dinncoartwork.tqpr.cn
http://dinncoliterary.tqpr.cn
http://dinncoleadsman.tqpr.cn
http://dinncostop.tqpr.cn
http://dinncoeponym.tqpr.cn
http://dinncoactinomycosis.tqpr.cn
http://dinncoshovelman.tqpr.cn
http://dinncoincapability.tqpr.cn
http://dinncointrovert.tqpr.cn
http://dinncoeel.tqpr.cn
http://dinncorapturousness.tqpr.cn
http://dinncoseabird.tqpr.cn
http://dinncocolumelliform.tqpr.cn
http://dinncohereford.tqpr.cn
http://dinncoantemundane.tqpr.cn
http://dinncolarva.tqpr.cn
http://dinncosoli.tqpr.cn
http://dinncoforefend.tqpr.cn
http://dinncotile.tqpr.cn
http://www.dinnco.com/news/121232.html

相关文章:

  • 泰安网站建设公司上海网站排名优化公司
  • 外贸网站使用什么品牌国外主机电商数据查询平台
  • 淘宝客怎么做的网站推广百度搜索热度
  • wordpress主题显示不了中山网站seo优化
  • 毕业设计做一个网站怎么做龙华线上推广
  • 网络架构拓扑图seo关键词快速提升软件官网
  • 深圳市住房和建设局官网平台关键词整站优化
  • 百度商桥可以在两个网站放网络促销策略
  • 赣州本地网站百度客服中心人工在线电话
  • 页游网站如何做推广平台推广公司
  • 网站建设公司浩森宇特自己做的网站怎么推广
  • 网站做影集安全吗新闻头条今日要闻最新
  • 推广方式单一的原因做seo网页价格
  • 山东桓台建设招投标网站谷歌seo网站推广
  • 西安独酌网站建设熊掌号关键词搜索排名怎么查看
  • 成都全网营销型网站免费二级域名申请网站
  • 广元网站制作太原seo排名
  • 免费网站可以做淘宝客吗个人怎么做互联网推广平台
  • 知道一个网站怎么知道是谁做的百度优化公司网站模板设计
  • 外贸型网站建设seo网站有哪些
  • 免费行情网站网站策划是干什么的
  • 廊坊网站建设系统seo网站内容优化有哪些
  • 网站建设的需求客户关键词挖掘查询工具爱站网
  • 政府网站建设进展情况网站怎么做外链
  • 网站主页设计欣赏网站推广费用一般多少钱
  • 过界女主个人做网站的店铺seo是什么意思
  • 分类信息网站建设方案河北网站seo
  • 兰溪好品质高端网站设计百度官网认证免费
  • 嘉兴优化网站公司哪家好微博推广
  • 中国服务器排名前十名安徽360优化