首页 > 其他分享 >ES 制造测试数据方法。

ES 制造测试数据方法。

时间:2024-01-28 21:13:24浏览次数:28  
标签:制造 index name 18 age copies 测试数据 item ES

 

 

import random

data = {"name": "tom", "age": 18}

# 复制100次
copies = [data.copy() for _ in range(11)]
aa='dddddddddd'
# 随机生成name和age
a= '{"index":{"_index":"dumpindex"}}'
for item in copies:
item["name"] = ''.join(random.choice('abcdefghijklmnopqrstuvwxyz') for _ in range(4))
item["age"] = random.randint(18, 30)

print( str(copies))
# print(a+'\n'+copies)

[{'name': 'pdbe', 'age': 18}, {'name': 'shyy', 'age': 23}, {'name': 'vtmi', 'age': 21}, {'name': 'atok', 'age': 27}, {'name': 'wuvt', 'age': 22}, {'name': 'pafm', 'age': 29}, {'name': 'lrlp', 'age': 21}, {'name': 'dhvf', 'age': 30}, {'name': 'qvzr', 'age': 19}, {'name': 'vhfd', 'age': 29}, {'name': 'kamw', 'age': 19}]

进程已结束,退出代码为 0

  {"index":{"_index":"dumpindex"}}
 {"name": "qrqp", "age": 28}
  {"index":{"_index":"dumpindex"}}
 {"name": "frxh", "age": 22}

标签:制造,index,name,18,age,copies,测试数据,item,ES
From: https://www.cnblogs.com/mengbin0546/p/17993337

相关文章

  • [Typescript] Handle CommonJS import in Typescript
    Let'ssayweneedtousealibrarywithcommonJScode.classMelon{cutIntoSlices(){}}module.exports=MelonThenwewanttoimportthisinsideourTypescriptproject:import*asmelonNamespacefrom"./melon"//typescriptdoesn......
  • ES数据迁移方案,-自己总结 基于REINDEX_API`
     跨集群ES数据迁移:1.设置白名单在目标ES库(新库)reindex.remote.whitelist:["192.168.9.201:9200"][或者下面参数:reindex.remote.whitelist:"10.*:*"http.cors.enabled:truehttp.cors.allow-origin:"*"]  2.利用kibana修改新ES参数,防止刷新影响性能.   PUT_settings......
  • Codeforces Round 920 (Div. 3)
    A-Square难度:⭐题目大意给定正方形的四个顶点,求该正方形的面积;解题思路根据四个点找出长和宽即可,因为数据范围有负数,为了方便我都进行了移位;神秘代码#include<bits/stdc++.h>#defineintlonglong#defineIOSios::sync_with_stdio(false);cin.tie(0......
  • 2021-2022 ICPC Southwestern European Regional Contest (SWERC 2021-2022)
    Preface这场打的也挺好的,前中期稳定出题,后期还和徐神接力写了一个K最后乱猜还猜对了H题的结论,可惜因为常数以及三分的bound等问题赛事没过最后10题舒服下班A.OrganizingSWERC签到,话说外国场的A基本都是签到啊#include<cstdio>#include<iostream>#defineRIregisterin......
  • OpenIM (Open-Source Instant Messaging) Mac Deployment Guide
    Thisguideprovidesstep-by-stepinstructionsfordeployingOpenIMonaMac,includingbothsourcecodeandDockerdeploymentmethods.##PreliminaryEnvironmentSetupEnsureacleanworkingenvironment:1.**CreateaNewDirectory**:Startinanewdirec......
  • Codeforces Round 921 (Div. 2) A-D
    倒叙讲题预警()传送门:https://codeforces.com/contest/1925D.GoodTrip题意:有n个小盆友,其中m对是好盆友,每队好盆友有友谊度fi。老师要举办k次远足,每次挑一对小盆友去,被挑到的小盆友友谊值+1。如果一对儿童不是朋友,那么他们的友谊值为0,在以后的游览中不会改变。求所有被选中参......
  • es集群配置文件参考
    #集群的名称,同一个集群该值必须设置成相同的cluster.name:clusterName#该节点的名字node.name:node-2#该节点有机会成为master节点node.master:true#该节点可以存储数据node.data:true#shard的数目#设置绑定的IP地址,可以是IPV4或者IPV6network.host:0.0.0.0#节点......
  • Rust学习之Diesel setup报错解决
    Dieselsetup报错解决Diesel是一个安全、可扩展的RustORM和查询生成器。Diesel是Rust中与数据库交互最高效的方式,因为它对查询进行了安全且可组合的抽象。1.报错信息diesel_demoonmaster[?]via......
  • 《Confusion Graph: Detecting Confusion Communities in Large Scale Image Classifi
    论文标题《ConfusionGraph:DetectingConfusionCommunitiesinLargeScaleImageClassification》混淆图:在大规模图像分类中检测混淆社区作者RuochunJin、YongDou、YueqingWang和XinNiu来自国防科技大学并行和分布式处理国家实验室,和上一篇是姊妹篇。初读摘要......
  • Codeforces Round 921 (Div. 1) 记录(A-D)
    比赛链接:https://codeforces.com/contest/1924官解链接:https://codeforces.com/blog/entry/125137这场整体来说表现还可以,最终performance\(2431\),delta\(+33\)。A.DidWeGetEverythingCovered?还不错的贪心题。进入状态有点慢,写了几个小错误B.SpaceHarbourC.Frac......