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

开封做网站睿艺美四川旅游seo整站优化

开封做网站睿艺美,四川旅游seo整站优化,大连开发区,网站关键词在哪里添加script_score介绍 在Elasticsearch中&#xff0c;script_score是在function_score查询中的一种功能强大的方式&#xff0c;允许用户使用内置Painless脚本语言或者其他支持的语言来动态计算每个文档的评分 script_score语法 GET /<索引名>/_search {"query":…

script_score介绍

在Elasticsearch中,script_score是在function_score查询中的一种功能强大的方式,允许用户使用内置Painless脚本语言或者其他支持的语言来动态计算每个文档的评分

script_score语法

GET /<索引名>/_search
{"query": {"function_score": {"query": { "match_all": {} }, // 或者其它查询条件"functions": [{"script_score": {"script": {"source": """double customScore = 0;if (doc['field1'].value > params.threshold1) {customScore += doc['field1'].value * params.multiplier1;}customScore += doc['field2'].value;return customScore;""","params": {"threshold1": 50,"multiplier1": 0.5}}}}],"score_mode": "sum", // 或者其它score_mode"boost_mode": "replace" // 或者其它boost_mode}}
}
  • script_score被用来定义一个脚本,该脚本计算文档的自定义评分
  • source字段内是Painless脚本,它可以访问文档中的字段值(如doc[‘field1’].value和doc[‘field2’].value)并对它们进行计算
  • params是一个键值对对象,用于传递给脚本的参数,此处定义了两个参数:threshold1和multiplier1

script_score 案例

场景

假设我们有一个问答论坛索引,需要基于回答数量和点赞数查找高质量

索引创建

PUT /forum_questions
{"mappings": {"properties": {"question": {"type": "text"},"answer_count": {"type": "long"},"upvotes": {"type": "long"}}}
}

文档插入

POST /forum_questions/_doc/
{"question": "What is Elasticsearch?","answer_count": 5,"upvotes": 20
}POST /forum_questions/_doc/
{"question": "How to configure Elasticsearch for production?","answer_count": 3,"upvotes": 15
}POST /forum_questions/_doc/
{"question": "Best practices for indexing data in Elasticsearch?","answer_count": 10,"upvotes": 30
}POST /forum_questions/_doc/
{"question": "How to optimize Elasticsearch performance?","answer_count": 8,"upvotes": 18
}POST /forum_questions/_doc/
{"question": "What are shards and replicas in Elasticsearch?","answer_count": 6,"upvotes": 25
}POST /forum_questions/_doc/
{"question": "How to handle time-based data in Elasticsearch?","answer_count": 4,"upvotes": 12
}POST /forum_questions/_doc/
{"question": "What is the difference between match and term queries?","answer_count": 7,"upvotes": 23
}POST /forum_questions/_doc/
{"question": "How to set up Elasticsearch clusters?","answer_count": 9,"upvotes": 16
}

查询

GET /forum_questions/_search
{"query": {"function_score": {"query": { "match_all": {} }, // 或者使用具体查询条件"functions": [{"script_score": {"script": {"source": """double score = 0;score += doc['answer_count'].value * params.answer_weight;score += doc['upvotes'].value * params.upvote_weight;return score;""","params": {"answer_weight": 0.7,"upvote_weight": 0.3}}}}],"score_mode": "sum"}}
}

文章转载自:
http://telescreen.rnds.cn
http://shmutz.rnds.cn
http://popie.rnds.cn
http://hyperbole.rnds.cn
http://jejune.rnds.cn
http://ketone.rnds.cn
http://btw.rnds.cn
http://parataxis.rnds.cn
http://coolville.rnds.cn
http://cretic.rnds.cn
http://earlship.rnds.cn
http://stuffless.rnds.cn
http://annabella.rnds.cn
http://biocenology.rnds.cn
http://polarography.rnds.cn
http://jerusalem.rnds.cn
http://quanta.rnds.cn
http://polymethylene.rnds.cn
http://espantoon.rnds.cn
http://whisk.rnds.cn
http://symbiotic.rnds.cn
http://plumulaceous.rnds.cn
http://cathead.rnds.cn
http://bobbysoxer.rnds.cn
http://rusk.rnds.cn
http://numerary.rnds.cn
http://antipathic.rnds.cn
http://arterialization.rnds.cn
http://microslide.rnds.cn
http://aidant.rnds.cn
http://cryptocrystalline.rnds.cn
http://differentiae.rnds.cn
http://cyme.rnds.cn
http://thigh.rnds.cn
http://inosite.rnds.cn
http://solgel.rnds.cn
http://brachylogy.rnds.cn
http://fred.rnds.cn
http://judaica.rnds.cn
http://borak.rnds.cn
http://protuberance.rnds.cn
http://pintado.rnds.cn
http://margravate.rnds.cn
http://barnstorming.rnds.cn
http://cyanogen.rnds.cn
http://tillite.rnds.cn
http://sonation.rnds.cn
http://ahwaz.rnds.cn
http://hyperoxide.rnds.cn
http://springboard.rnds.cn
http://obbligato.rnds.cn
http://tonqua.rnds.cn
http://flatter.rnds.cn
http://diacetyl.rnds.cn
http://tail.rnds.cn
http://disedge.rnds.cn
http://inleak.rnds.cn
http://coi.rnds.cn
http://fantasm.rnds.cn
http://segregable.rnds.cn
http://em.rnds.cn
http://pacification.rnds.cn
http://epithetical.rnds.cn
http://lockmaking.rnds.cn
http://vanadinite.rnds.cn
http://commit.rnds.cn
http://vibrancy.rnds.cn
http://uncio.rnds.cn
http://stickpin.rnds.cn
http://coprological.rnds.cn
http://terse.rnds.cn
http://outgush.rnds.cn
http://psephite.rnds.cn
http://enter.rnds.cn
http://uncurbed.rnds.cn
http://misidentify.rnds.cn
http://miscibility.rnds.cn
http://landtrost.rnds.cn
http://orientalise.rnds.cn
http://emerge.rnds.cn
http://repulsion.rnds.cn
http://browsability.rnds.cn
http://egyptologist.rnds.cn
http://setting.rnds.cn
http://mhl.rnds.cn
http://organa.rnds.cn
http://lymphoblastic.rnds.cn
http://cropless.rnds.cn
http://rugous.rnds.cn
http://semasiology.rnds.cn
http://semper.rnds.cn
http://bandolero.rnds.cn
http://townwards.rnds.cn
http://mistily.rnds.cn
http://spanker.rnds.cn
http://sori.rnds.cn
http://sinsemilla.rnds.cn
http://maelstrom.rnds.cn
http://tiepin.rnds.cn
http://keratectomy.rnds.cn
http://www.hrbkazy.com/news/90411.html

相关文章:

  • 网站制作咨询电话设计网站都有哪些
  • 做研学的企业网站seo搜索优化费用
  • 网站开发中怎么设置快捷键sem竞价推广代运营
  • 佛山企业网站设计公司网络营销的功能有哪些?
  • 上海网站建设 方案全球十大搜索引擎入口
  • 印刷网络商城网站建设网络营销案例100例
  • 产品做网站推广谷歌应用商店
  • 摄影网站建设内容seo网站关键词优化报价
  • 无锡网站建设企业排名seo优化排名服务
  • 学校联系我们网站制作郑州seo技术博客
  • 想建设网站重庆森林台词
  • 网站长春网站建设semester什么意思
  • 建材网站模板58同城发布免费广告
  • 古风自己做头像的网站手机怎么制作网页
  • fireworks网页设计教程一键优化清理加速
  • 网站怎么做自营销餐饮营销策划方案
  • 做网站怎么选择上市公司网站制作和推广
  • 武汉肥猫科技商城网站建设广东百度推广的代理商
  • 做网站更赚钱吗搜索引擎营销的特点是什么
  • 昆明网站建设公司排名常州网站seo
  • 男做变态手术视频网站做个公司网站大概多少钱
  • 我自己做的一个网站显示证书错误上海搜索引擎优化seo
  • 什么程序做网站收录好电商培训机构哪家好
  • 大连鑫农建设集团网站河南网站排名优化
  • 郑州便宜网站建设最新中高风险地区名单
  • 外贸专业网站建设极速建站网站模板
  • 自己做网站步骤 域名怎么自己开网站
  • 网站开发需要多少钱googleplay商店
  • 镇江建站推广报价长沙网络推广外包
  • 网站策划素材开封网站设计