探索你的数据
示例数据集
现在我们已经对基础知识有所了解. 现在让我们试试在一些现实世界的数据集上工作. 我已经准备了一个关于客户银行帐户信息的虚构JSON文档的示例。每个文档都有以下模式:
{
"account_number": 0,
"balance": 16623,
"firstname": "Bradshaw",
"lastname": "Mckenzie",
"age": 29,
"gender": "F",
"address": "244 Columbus Place",
"employer": "Euron",
"email": "[email protected]",
"city": "Hobucken",
"state": "CO"
}
出于好奇, 这些数据是通过 www.json-generator.com生成的. 所以请忽略这些值和语义, 因为这些数据都是随机生成出来的.
加载示例数据集
你可以下载示例数据集(accounts.json)https://github.com/elastic/elasticsearch/blob/master/docs/src/test/resources/accounts.json?raw=true. 解压并把他加载到我们的集群中去.
curl -H "Content-Type: application/json" -XPOST "localhost:9200/bank/_doc/_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 z_feqkLHQKGezFJ7Y_XZBw 5 1 1000 0 474.6kb 474.6kb
这意味着我们(在_doc类型下)批量索引了1000个银行文档到银行索引下.