ES常用增删改查运维操作

ES常用增删改查小白运维操作

简介

收藏 ES 常用小白运维操作,满足基本需求

基础操作

新增索引

PUT test_index
{
  "mappings": {
    "properties": {
      "name": {
        "type": "keyword"
      }
    }
  }
}

查询索引下映射关系

GET test_index/_mapping

添加数据

POST test_index/_doc
{
  "name": "张三"
}

查询数据

GET test_index/_doc/SDOgQnYB081yE3IodCn7

更新数据

POST test_index/_update/SDOgQnYB081yE3IodCn7
{
  "doc": {
    "name": "new_name"
  }
}

删除数据

DELETE test_index/_doc/SDOgQnYB081yE3IodCn7

删除索引

DELETE test_index

其他常用操作

获取索引列表

?v 表示携带标题

GET _cat/indices?v

查询所有数据

默认前10条

POST test_index/_search

查询按照指定字段(时间)倒序

update_time 为索引包含字段

POST test_index/_search?sort=update_time:desc

查询指定 id 数据

POST test_index/_doc/SDOgQnYB081yE3IodCn7

精确查询

POST test_index/_search
{
  "query": {
    "match": {
      "name": "张三"
    }
  }
}

模糊查询

支持 AND OR 操作符,也支持 * 代表任意个字符

POST test_index/_search
{
  "query": {
    "query_string": {
      "default_field": "name",
      "query": "*三"
    }
  }
}
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值