1. 先创建一个索引

curl -XPUT 'http://10.128.xx.yy:9200/wechat_data'

2. 再创建mapping。 例如:

curl -XPOST 'http://10.128.XX.YY:9200/wechat_data/wechat_data/_mapping?pretty' -H 'Content-Type:application/json' -d' {


"wechat_data": {
    "dynamic": "false",
    "properties": {
        "wechat_id": {
            "store": true,
            "type": "keyword"
        },
        "creator": {
           "store": true,
            "type": "keyword"
        },
        "groupId": {
             "store": true,
              "type": "keyword"
        },

        "description": {
            "analyzer": "standard",
            "type": "text"
        },
        "insert_time": {
            "format": "yyyy-MM-dd HH:mm:ss",
            "store": true,
            "type": "date"
        },

        "reading": {
            "store": true,
            "type": "integer"
        },

        "auto_id": {
            "store": true,
            "type": "long"
        },

        "createDate": {
            "format": "yyyy-MM-dd HH:mm:ss",
            "store": true,
            "type": "date"
        }
    }
    }
}

'

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐