Elasticsearch——1、创建

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
        }
    }
}

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值