一、数据准备
百度网盘链接
链接:https://pan.baidu.com/s/1rPZBvH-J0367yQDg9qHiwQ?pwd=7n5n
提取码:7n5n
文档格式
{"index":{"_id":"1"}}
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}
{"index":{"_id":"6"}}
{"account_number":6,"balance":5686,"firstname":"Hattie","lastname":"Bond","age":36,"gender":"M","address":"671 Bristol Street","employer":"Netagy","email":"hattiebond@netagy.com","city":"Dante","state":"TN"}
{"index":{"_id":"13"}}
{"account_number":13,"balance":32838,"firstname":"Nanette","lastname":"Bates","age":28,"gender":"F","address":"789 Madison Street","employer":"Quility","email":"nanettebates@quility.com","city":"Nogal","state":"VA"}
PS:
(1)json 数据集的内容以行作为分割,不要添加除换行以外的空格
(2)每两行作为一条文档,第一行的 _id 指明该条文档的id;第二行为具体的数据内容;
(3)行与行之间需要回车隔开
二、数据导入Elasticsearch
(1)使用 POST 请求:localhost:9200/accounts/_bulk
(2)请求体 Body 选择 binary,接着 Select File 选择需要写入的上述 json 文件
(3)返回结果
响应中的 errors 为 false 即为批量导入成功;文章来源:https://www.toymoban.com/news/detail-647640.html
三、使用kibana查验
POST /accounts/_search
{
"query": {
"match_all": {}
}
}
至此,1000条测试数据导入成功文章来源地址https://www.toymoban.com/news/detail-647640.html
到了这里,关于Elasticsearch官方测试数据导入的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!