ElasticSearch 7.x 中新建表(Mapping)、新增字段(Field)、新增文档(doc)

新建表(Mapping) 示例

PUT user_manager
{
    "mappings": {
        "properties": {
            "id": {
                "type": "keyword"
            },
            "status": {
                "type": "keyword"
            },
            "createTime": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss"
            },
            "updateTime": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss"
            }
        }
    }
}

新增字段(Field) 示例

POST user_manager/_mapping
{
  "properties": {
    "openId": {
      "type": "keyword"
    }
  }
}

新增文档(doc) 示例

POST user_manager/_doc/1551753844109601212
{
    "id": "1551753844109601212",
    "type": [
        "3"
    ],
    "userId": "123",
    "userName": "test",
    "title": "大欢喜",
    "thumb": "img/test.png",
    "status": "1",
    "createTime": "2022-07-08 16:32:23",
    "updateTime": "2022-07-08 16:32:23"
}
posted @ 2022-11-11 21:28  yourxiong  阅读(167)  评论(0)    收藏  举报