Elasticsearch映射操作mapping

Elasticsearch    映射操作

1、创建mapping

curl-XPUT'http: //192.168.0.128: 9200/yang/user/_mapping'-d'{
    "user": {
        "properties": {
            "userid": {
                "type": "string",
                "store": true
            },
            "message": {
                "type": "string",
                "store": true
            }
        }
    }
}'

2、修改mapping

curl-XPUT' http: //192.168.0.128: 9200/yang/user/_mapping'-d'{
    "user": {
        "properties": {
            "userid": {
                "type": "string",
                "store": true
            },
            "message": {
                "type": "string",
                "store": true
            },
            "username": {
                "type": "string",
                "store": true
            }
        }
    }
}'

3、删除mapping

 curl -X DELETE 'http://192.168.0.128:9200/yang/_mapping/user'

4、查看mapping

 curl -X GET 'http://192.168.0.128:9200/yang/_mapping/user'

结果

{
    yang: {
        mappings: {
            user: {
                properties: {
                    message: {
                        type: "string",
                        store: true
                    },
                    userid: {
                        type: "string",
                        store: true
                    },
                    username: {
                        type: "string",
                        store: true
                    }
                }
            }
        }
    }
}



你可能感兴趣的:(elasticsearch,mapping)