Saul's blog Saul's blog
首页
后端
分布式
前端
更多
分类
标签
归档
友情链接
关于
GitHub (opens new window)

Saul.J.Wu

立身之本,不在高低。
首页
后端
分布式
前端
更多
分类
标签
归档
友情链接
关于
GitHub (opens new window)
  • Java入门基础

  • Java核心基础

  • 设计模式

  • Web开发

  • SpringBoot

  • 微服务

  • Elasticsearch

    • ElasticSearch-简介
    • Elasticsearch-安装
    • Elasticsearch-_cat
    • Elasticsearch-新增数据
    • Elasticsearch-查询数据&乐观锁
    • Elasticsearch-更新文档
    • Elasticsearch-删除操作
      • 语法格式
      • 删除文档请求实例
      • 删除索引
    • Elasticsearch-Bulk 批量 API
    • Elasticsearch-Search API
    • Elasticsearch-Query DSL
    • Elasticsearch-aggregations聚合分析
    • Elasticsearch-mapping映射
    • Elasticsearch-分词
    • SpringBoot整合Elasticsearch Rest Client
    • 商品上架与ES
  • 运维

  • 后端
  • Elasticsearch
SaulJWu
2020-11-24

Elasticsearch-删除操作

# 语法格式

DELETE customer/external/1
DELETE customer
1
2

# 删除文档请求实例

  • 请求路径 DELETE请求
http://192.168.56.10:9200/customer/external/1
1
  • 返回Status:200 OK
{
    "_index": "customer",
    "_type": "external",
    "_id": "1",
    "_version": 6,
    "result": "deleted",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 11,
    "_primary_term": 1
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

当删除成功后,再去查询这条数据

GET http://192.168.56.10:9200/customer/external/1
1
  • 返回Status:404 Not Found
{
    "_index": "customer",
    "_type": "external",
    "_id": "1",
    "found": false //没有找到这条数据
}
1
2
3
4
5
6

# 删除索引

ES并未提供删除类型的操作,只有删除文档后者索引

  • 请求路径
http://192.168.56.10:9200/customer
1
  • 返回Status:200 OK
{
    "acknowledged": true
}
1
2
3

这时候,再去查询数据,返回Status:404 Not Found

{
    "error": {
        "root_cause": [
            {
                "type": "index_not_found_exception",
                "reason": "no such index [customer]",
                "resource.type": "index_expression",
                "resource.id": "customer",
                "index_uuid": "_na_",
                "index": "customer"
            }
        ],
        "type": "index_not_found_exception",
        "reason": "no such index [customer]",
        "resource.type": "index_expression",
        "resource.id": "customer",
        "index_uuid": "_na_",
        "index": "customer"
    },
    "status": 404
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
帮我改善此页面 (opens new window)
#Elasticsearch#删除
上次更新: 2020/12/17, 08:38:35
Elasticsearch-更新文档
Elasticsearch-Bulk 批量 API

← Elasticsearch-更新文档 Elasticsearch-Bulk 批量 API→

最近更新
01
zabbix学习笔记二
02-28
02
zabbix学习笔记一
02-10
03
Linux访问不了github
12-08
更多文章>
Theme by Vdoing | Copyright © 2020-2022 Saul.J.Wu | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式