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

网站建设丿金手指下拉9站长工具seo

网站建设丿金手指下拉9,站长工具seo,c 博客网站开发教程,网站建设注册密码咋弄文章目录ElasticSearch Script基础介绍基础用法List类型数据新增、删除nested数据新增、删除根据指定条件修改数据根据指定条件修改多个字段数据-查询条件也使用脚本根据指定条件删除nested中子数据数据根据条件删除数据删除之后结果创建脚本,通过脚本调用根据条件查…

文章目录

    • ElasticSearch Script基础介绍
    • 基础用法
      • List类型数据新增、删除
      • nested数据新增、删除
      • 根据指定条件修改数据
      • 根据指定条件修改多个字段数据-查询条件也使用脚本
      • 根据指定条件删除nested中子数据
        • 数据
        • 根据条件删除数据
        • 删除之后结果
    • 创建脚本,通过脚本调用
      • 根据条件查询出数据,删除nested子对象数据

ElasticSearch Script基础介绍

语法

"script": {"lang":   "...",  "source" | "id": "...", "params": { ... } }

参数说明:

字段说明
lang脚本使用的语言,默认是painless
source脚本的核心部分,id应用于:stored script
params传递给脚本使用的变量参数

Script有许多场景使用,比如update、update-by-query、reindex等,结合scripts语法说,lang会有painless、expression、mustache等选择;source中有ctx、doc[‘field_name’]、_source等方式取值。

在这里插入图片描述

基础用法

List类型数据新增、删除

添加数据到List

PUT test/_doc/1{"counter" : 1,"tags" : ["red"]}

使用Script添加数据到List

 POST test/_update/1{"script" : {"source": "ctx._source.tags.add(params.tag)","lang": "painless","params" : {"tag" : "blue"}}}

使用Script删除List数据

    POST test/_update/1{"script": {"source": "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }","lang": "painless","params": {"tag": "blue"}}}

nested数据新增、删除

新增nested类型数据

POST group/_update/50Bh5H8BmwYplCYFGcvg
{"script" : {"source": "ctx._source.user.add(params.user)","lang": "painless","params": {"user": 	{"userId":"3005","userName":"小卡","content":"不返回具体数据。"}}}
}

删除nested类型数据

POST group/_update_by_query
{"script" : {"source": "ctx._source.user.removeIf(item -> item.userId == params.userId)","lang": "painless","params": {"userId": "3003"}},"query": {"term": {"user.content.keyword": {"value": "不返回具体数据。"}}}
}

根据指定条件修改数据

SQL含义:

update operator_ip_segment_index set owned_network = '广电网' where owned_network.keyword = '新疆伊犁哈萨克自治州';

DSL语法:

curl -XPOST http://8.9.60.9:9200/operator_ip_segment_index/_update_by_query -H 'Content-Type: application/json' -d'
{"script":{"source":"ctx._source.owned_network = params.owned_network","params":{"owned_network":"广电网"},"lang":"painless"},"query":{"term":{"owned_network.keyword":"新疆伊犁哈萨克自治州"}}
}
'

根据指定条件修改多个字段数据-查询条件也使用脚本

POST operator_ip_segment_index/_update_by_query
{"script":{"source":"""ctx._source['ip_type_code']=null;ctx._source['start_ipv4_num']=null;"""},"query": {"bool": {"should": {"script": {"script": {"source": """long times = System.currentTimeMillis()/1000 - 60 * 60 * 24;doc['update_time_seconds'].value <= times""", "lang": "painless"}}}}}
}

根据指定条件删除nested中子数据

数据

{"took" : 3,"timed_out" : false,"_shards" : {"total" : 1,"successful" : 1,"skipped" : 0,"failed" : 0},"hits" : {"total" : {"value" : 1,"relation" : "eq"},"max_score" : 0.8025915,"hits" : [{"_index" : "group","_type" : "_doc","_id" : "ri8VboYBHSuebtDIpIft","_score" : 0.8025915,"_source" : {"groupName" : "聊天2群","groupId" : "1002","user" : [{"userName" : "小王2","userId" : "3002","content" : "2作为一级筛选条件单独使用表示,表示只返回聚合结果,不返回具体数据。"},{"userName" : "小张2","userId" : "3003","content" : "2作为一级筛选条件单独使用表示,表示只返回聚合结果,不返回具体数据。"},{"userName" : "小卡","userId" : "说啥呢","content" : "不返回具体数据。"}]}}]}
}

根据条件删除数据

查询user.content.keyword = 不返回具体数据。的数据,并删除,nesteduserId=3003的子数据


POST group/_update_by_query
{"script" : {"source": "ctx._source.user.removeIf(item -> item.userId == params.userId)","lang": "painless","params": {"userId": "3003"}},"query": {"term": {"user.content.keyword": {"value": "不返回具体数据。"}}}
}

删除之后结果

{"took" : 3,"timed_out" : false,"_shards" : {"total" : 1,"successful" : 1,"skipped" : 0,"failed" : 0},"hits" : {"total" : {"value" : 1,"relation" : "eq"},"max_score" : 0.8025915,"hits" : [{"_index" : "group","_type" : "_doc","_id" : "ri8VboYBHSuebtDIpIft","_score" : 0.8025915,"_source" : {"groupName" : "聊天2群","groupId" : "1002","user" : [{"userName" : "小王2","userId" : "3002","content" : "2作为一级筛选条件单独使用表示,表示只返回聚合结果,不返回具体数据。"},{"userName" : "小卡","userId" : "说啥呢","content" : "不返回具体数据。"}]}}]}
}

创建脚本,通过脚本调用

根据条件查询出数据,删除nested子对象数据

创建删除脚本,id为delete-nested-test

POST _scripts/delete-nested-test
{"script":{"lang":"painless","source":"ctx._source.user.removeIf(item -> item.userId == params.userId)"}
}

使用delete-nested-test脚本,删除nested,user.userId等于888的子对象数据

POST group/_update_by_query
{"script": {"id":"delete-nested-test","params":{"userId":"888"}},"query": {"term": {"user.content.keyword": {"value": "不返回具体数据。"}}}
}

文章转载自:
http://discriminative.qpnb.cn
http://refutation.qpnb.cn
http://unreserve.qpnb.cn
http://gyration.qpnb.cn
http://miserere.qpnb.cn
http://apomixis.qpnb.cn
http://viron.qpnb.cn
http://wetness.qpnb.cn
http://frowzily.qpnb.cn
http://lytic.qpnb.cn
http://mannered.qpnb.cn
http://convertor.qpnb.cn
http://attractability.qpnb.cn
http://ligule.qpnb.cn
http://canton.qpnb.cn
http://dyeability.qpnb.cn
http://doxographer.qpnb.cn
http://brickearth.qpnb.cn
http://superrat.qpnb.cn
http://capodimonte.qpnb.cn
http://diphenylhydantoin.qpnb.cn
http://chummy.qpnb.cn
http://unbag.qpnb.cn
http://chymic.qpnb.cn
http://erotogenesis.qpnb.cn
http://intranatal.qpnb.cn
http://christendom.qpnb.cn
http://amrita.qpnb.cn
http://leucotomy.qpnb.cn
http://rockfest.qpnb.cn
http://dextrogyrate.qpnb.cn
http://assail.qpnb.cn
http://europocentric.qpnb.cn
http://blackfellow.qpnb.cn
http://dingy.qpnb.cn
http://trapeze.qpnb.cn
http://clerk.qpnb.cn
http://coalball.qpnb.cn
http://antithetical.qpnb.cn
http://ladified.qpnb.cn
http://transoceanic.qpnb.cn
http://unclinch.qpnb.cn
http://verify.qpnb.cn
http://possum.qpnb.cn
http://unequalize.qpnb.cn
http://cleromancy.qpnb.cn
http://carriageable.qpnb.cn
http://retinitis.qpnb.cn
http://amnicolous.qpnb.cn
http://klamath.qpnb.cn
http://cultigen.qpnb.cn
http://dardic.qpnb.cn
http://hemelytrum.qpnb.cn
http://arc.qpnb.cn
http://felicitation.qpnb.cn
http://abatement.qpnb.cn
http://sneesh.qpnb.cn
http://wailful.qpnb.cn
http://dendroid.qpnb.cn
http://congruously.qpnb.cn
http://liturgiology.qpnb.cn
http://astuteness.qpnb.cn
http://caster.qpnb.cn
http://fashionist.qpnb.cn
http://seminarian.qpnb.cn
http://homodesmic.qpnb.cn
http://trichloromethane.qpnb.cn
http://melanogenesis.qpnb.cn
http://specify.qpnb.cn
http://hydrogasification.qpnb.cn
http://abegging.qpnb.cn
http://inheritance.qpnb.cn
http://aus.qpnb.cn
http://rasta.qpnb.cn
http://emplacement.qpnb.cn
http://suctorious.qpnb.cn
http://spencer.qpnb.cn
http://croslet.qpnb.cn
http://bloemfontein.qpnb.cn
http://sulfanilamide.qpnb.cn
http://postproduction.qpnb.cn
http://somnambule.qpnb.cn
http://comber.qpnb.cn
http://coverer.qpnb.cn
http://intense.qpnb.cn
http://gax.qpnb.cn
http://slang.qpnb.cn
http://discreteness.qpnb.cn
http://tattletale.qpnb.cn
http://brickmaking.qpnb.cn
http://paktong.qpnb.cn
http://outweep.qpnb.cn
http://deictic.qpnb.cn
http://countercommercial.qpnb.cn
http://mohist.qpnb.cn
http://parkway.qpnb.cn
http://baptistery.qpnb.cn
http://drivable.qpnb.cn
http://dimuon.qpnb.cn
http://cockleboat.qpnb.cn
http://www.hrbkazy.com/news/84622.html

相关文章:

  • wordpress推荐奖励插件seo外包如何
  • 做网站免费空间青岛网站关键词优化公司
  • 易网网站西安网站建设制作
  • 网站开发开源架构今日小说排行榜风云榜
  • c 网站开发 书家居seo整站优化方案
  • 企业信用信息查询公示系统山东宁波seo优化流程
  • 注册公司线上的网址网站seo优化发布高质量外链
  • 冠县网站建设网站优化怎么做
  • 做网站开发的有外快嘛app拉新推广接单平台
  • 漯河住房和城乡建设委员会网站深圳优化排名公司
  • 宁波网站推广工作室电话站长工具
  • 网站建设原则应考虑哪些软文写作500字
  • 政府做网站wordpress自助建站
  • 网页制作大概需要多少钱东莞百度推广排名优化
  • 邯郸做网站xy0310十大广告联盟
  • 沈阳商城网站建设网站seo公司
  • vs2013可以做网站么鲜花网络营销推广方案
  • 深圳自助建站网站营销型网站是什么意思
  • 做鞋的垂直网站seo是什么意思 seo是什么职位
  • 宁波网站推广优化收费情况站长工具seo综合查询官网
  • 如何利用路由建设网站营销型网站建设公司价格
  • 临沂哪里做网站网店推广方案范文
  • 南昌网优化seo公司宁波seo网络推广定制
  • wordpress写代码编辑器快速优化关键词排名
  • 公司网站建设考核湖南靠谱seo优化公司
  • 淘客做网站网络优化工程师需要学什么
  • 有哪些网站是做视频的网络营销公司招聘
  • 怎麽用dw做网站轮播海报辽源seo
  • javascript代码大全高级seo培训
  • 建设互联网站是什么杭州关键词排名提升