ES-endpoint

1 常用endpoint

方式endpoint描述
PUT [index]新建索引  请求体可参考:2.1 新建索引请求体样式 
_template/[template]添加模板  请求体可参考:2.2  新建模板请求体样式 
[index]/[type]/[id]添加数据,无[id]时,随机生成20位的id  请求体可参考:2.3 添加数据请求体样式
[index]/_settings修改索引设置信息  请求体可参考:2.7 
POST

[index]/[type]/[id]

添加数据,无[id]时,随机生成20位的id  请求体可参考:2.3 添加数据请求体样式
_reindex数据迁移 请求体可参考: 2.4 数据迁移请求体样式
[index]/_delete_by_query基于查询的删除  请求体内容:  DSL query查询语句
[index]/[type]/[id]/_update更新数据 请求体可参考: 2.5 更新请求体样式
GET[index]/[type]/_search查询索引中数据, [index],[type]可选,控制范围. 请求体内容 : DSL query查询语句  
lib*/_search查询所有相同前缀索引数据
_cat/indices查询所有索引及容量
[index]/_mapping查询索引映射结构,无[index]时,查所有映射信息
_all查询所有索引映射结构
_template查询所有模板
_template/[template]查询指定模板
_cluster/health查询集群健康状态
_cat/nodes查询所有节点
_cat/shards查询索引及分片的分布
_cat/plugins查询所有插件
[index]/[type]/_count查看文档数量 [index],[type]可选,控制范围
[index]/[type]/[id]/_source不查询文档的元数据,只查询source部分的数据
[index]/[type]/_mget取回多个文档,[index]/[type]可选,控制范围,请求体内容  2.6 mget请求体样式 
[index]/_settings查看索引设置信息,[index] 可选,控制范围
  
DELETE[index]删除索引
[index]/[type]/[id]通过id删除数据
_template/[template]删除模板
  
  
  

 

2. 备注

2.1 新建索引请求体样式

{
  "mappings": {
    "doc": {
      "properties": {
        "name": {
          "type": "text"
        },
        "blob": {
          "type": "binary"
        }
      }
    }
  }
}

2.2  新建模板请求体样式

{
    "template" : "my-*",
    "order" : 0,
    "settings" : {
         "number_of_shards" : 10,
 "number_of_replicas" : 0
    },
    "mappings": {

      "default": {

  "_all": {
        "enabled": false
      },
        "properties": {
          "name": {
            "type": "text"
          },
          "age": {
            "type": "long"
          }
        }
    }
  }
}

2.3 添加数据请求体样式

2.4 数据迁移请求体样式

{
  "source": {
    "index": "my_index"
  },
  "dest": {
    "index": "new_my_index"
  }
}

2.5 更新请求体样式

{
    "doc":{
        "name":"kyle",
        "age":20
    }
}

2.6 mget请求体样式

//可在endpoint中指定index type,也可在请求体中指定
{
   "docs" : [
      {
         "_index" : "demo2",
         "_type" :  "system",
         "_id" :    2,
         "_source":[
             "name"
         ]
      }
   ]
}
//只指定index,可根据is查询
{
   "ids":[1,2]
}

2.7 设置请求体样式

{  
    "index" : {
   "number_of_replicas":0
    }
} 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

郑重其事,鹏程万里

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值