栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

elasticsearch es 基本的增删改查

elasticsearch es 基本的增删改查

安装postman

put http://localhost:9200/blog/ariticle/1

{
"title":"New version of Elasticsearch released!",
"content":"Version 2.0 released today!"
}


结果

{
    "_index": "blog",
    "_type": "ariticle",
    "_id": "1",
    "_version": 6,
    "result": "created",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 7,
    "_primary_term": 1
}
注意

操作时如果index、type、id等不存在则会自动创建,如果这条id的数据已经存在则是更新这条数据如果不指定 Id,需改为POST 请求,就会随机生成id 例如:

post http://localhost:9200/blog/ariticle

{
    "_index": "blog",
    "_type": "ariticle",
    "_id": "xFjzbX8B_fwVMtrHLk44",(随机的id)
    "_version": 1,
    "result": "created",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 11,
    "_primary_term": 1
}
delete http://localhost:9200/blog/ariticle/1


结果

get http://localhost:9200/blog/ariticle/1


结果

{
    "_index": "blog",
    "_type": "ariticle",
    "_id": "1",
    "_version": 3,
    "_seq_no": 2,
    "_primary_term": 1,
    "found": true,
    "_source": {
        "title": "New version of Elasticsearch released!",
        "content": "Version 2.0 released today!"
    }
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/758107.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号