1、结构
-
Index:Elasticsearch的Index相当于数据库的Table
- Type:这个在新的Elasticsearch版本已经废除(在以前的Elasticsearch版本,一个Index下支持多个Type--有点类似于消息队列一个topic下多个group的概念)
- Document:Document相当于数据库的一行记录
- Field:相当于数据库的Column的概念
- Mapping:相当于数据库的Schema的概念
- DSL:相当于数据库的SQL(给我们读取Elasticsearch数据的API)
2、字段类型
https://blog.csdn.net/chengyuqiang/article/details/79048800
3、例子
PUT /vacation_record_index
{
"mappings": {
"doc": {
"properties": {
"id": {
"type": "long"
},
"staffId": {
"type": "long"
},
"name": {
"type": "text"
},
"ldap": {
"type": "text"
},
"empId": {
"type": "text"
},
"staffType": {
"type": "integer"
},
"staffStatus": {
"type": "integer"
},
"orgId": {
"type": "long"
},
"vacType": {
"type": "integer"
},
"day": {
"type": "double"
},
"reason": {
"type": "text"
},
"startTime": {
"type": "long"
},
"endTime": {
"type": "long"
},
"processFinishTime": {
"type": "long"
},
"processStartTime": {
"type": "long"
},
"processStatus": {
"type": "integer"
},
"h3ProcessId": {
"type": "long"
},
"isModified": {
"type": "boolean"
},
"company": {
"type": "keyword"
},
"workCity": {
"type": "keyword"
}
}
}
},
"settings": {
"index": {
"number_of_shards": 3,
"number_of_replicas": 2
}
}
}