Elasticsearch数据操作

插入数据

curl -XPUT 'http://192.168.0.128:9200/yang/user/_create'  -d  '{"userid":"12","username":"yangshuangjun","message":"123"}'

返回数据

{"_index":"yang","_type":"user","_id":"_create","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}

插入指定id

curl -XPUT 'http://192.168.0.128:9200/yang/user/4'  -d  '{"userid":"12","username":"yangshuangjun","message":"123"}'

查看指定id

curl -XGET 'http://192.168.0.128:9200/yang/user/4'

返回如下

{
    _index: "yang",
    _type: "user",
    _id: "4",
    _version: 1,
    found: true,
    _source: {
        userid: "12",
        username: "yangshuangjun",
        message: "123"
    }
}



你可能感兴趣的:(elasticsearch,数据存取)