样本数据
现在我们已经了解了基本知识,让我们尝试使用更真实的数据。
我们提供了一些虚构的客户银行账户信息,格式如下所示:
{
"account_number": 0,
"balance": 39988,
"firstname": "Kevin",
"lastname": "Wu",
"age": 35,
"gender": "F",
"address": "525 Xixi Road",
"employer": "Qikegu",
"email": "kevinwu@qikegu.com",
"city": "Hangzhou",
"province": "Zhejiang"
}
加载样本数据
可以从这里下载样本数据(accounts.json)。将其放到当前目录,加载到集群中,如下所示:
curl -H "Content-Type: application/json" -XPOST "localhost:9200/bank/_bulk?pretty&refresh" --data-binary "@accounts.json"
curl "localhost:9200/_cat/indices?v"
响应:
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open bank YBca-2v7SbKGBrnv222USQ 1 1 1000 0 438kb 438kb
可以看到,1000个文档已经批量存储到bank
索引中。