Elasticsearch官方测试数据导入

一、数据准备

百度网盘链接

链接: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":"[email protected]","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":"[email protected]","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":"[email protected]","city":"Nogal","state":"VA"}

PS:
(1)json 数据集的内容以行作为分割,不要添加除换行以外的空格
(2)每两行作为一条文档,第一行的 _id 指明该条文档的id;第二行为具体的数据内容;
(3)行与行之间需要回车隔开

二、数据导入Elasticsearch

(1)使用 POST 请求:localhost:9200/accounts/_bulk
(2)请求体 Body 选择 binary,接着 Select File 选择需要写入的上述 json 文件

Elasticsearch官方测试数据导入_第1张图片
(3)返回结果

Elasticsearch官方测试数据导入_第2张图片
响应中的 errorsfalse 即为批量导入成功;

三、使用kibana查验

POST /accounts/_search
{
  "query": {
    "match_all": {}
  }
}

Elasticsearch官方测试数据导入_第3张图片
至此,1000条测试数据导入成功

你可能感兴趣的:(Elasticsearch,elasticsearch,搜索引擎,全文检索)