关于用Elasticsearch进行文档管理的的补充
ES数据模型
文档(Document)管理
文件是ES最小数据单元
原始数据:_source:原始JSON格式文档
文档元数据:
_index:索引名
_type 索引类型
_id 文档编号
_version 文档版本号
索引的创建
PUT demo.12 //索引名
{
"settings" : {
"index" : {
"number_of_shards" : 2, //主分片数量,默认5
"number_of_replicas" : 2 //副本数量,默认1
}
}
}
PUT 更新 或创建
批量操作bulk文件:
PUT _bulk
{
"index/create/update/delete":{
"_index":"...","_type":"...","_id":"..."}}
{
json串,如}
例子,不能换行
{
"create":