es搜索引擎,Kibana语法

<REST Verb> /<Index>/<Type>/<ID>
<REST动词> / <索引> / <类型> / <ID>
 
#检查群集运行状况
GET /_cat/health?v
 
#获得群集中的节点列表
GET /_cat/nodes?v
 
#列出所有索引
GET /_cat/indices?v
 
#创建索引并查看
PUT /customer?pretty
GET /_cat/indices?v
 
#指定ID插入数据并查看(如果没有该索引则默认自动创建)
PUT /customer/_doc/1?pretty
{
  "name": "John Doe"
}
GET /customer/_doc/1?pretty
#删除索引并查看
DELETE /customer?pretty
GET /_cat/indices?v
 
#不指定ID插入数据会自动分配ID
POST /customer/_doc?pretty
{
  "name": "Jane Doe"
}
 
#替换文档版本号会递增,若该ID尚未使用则相当于插入数据
GET /customer/_doc/1?pretty
PUT /customer/_doc/1?pretty
{
  "name": "John Doe"
}
GET /customer/_doc/1?pretty
PUT /customer/_doc/1?pretty
{
  "name": "Jane Doe"
}
GET /customer/_doc/1?pretty
PUT /customer/_doc/2?pretty
{
  "name": "Jane Doe"
}
 
#通过将名称字段更改为“Jane Doe”来更新以前的文档(ID为1)
GET /customer/_doc/1?pretty
POST /customer/_doc/1/_update?pretty
{
  "doc": { "name": "Jane Doe" }
}
GET /customer/_doc/1?pretty
#通过将名称字段更改为“Jane Doe”来更新我们以前的文档(ID为1),同时向其添加年龄字段
POST /customer/_doc/1/_update?pretty
{
  "doc": { "name": "Jane Doe", "age": 20 }
}
GET /customer/_doc/1?pretty
#使用脚本将年龄增加5
POST /customer/_doc/1/_update?pretty
{
  "script" : "ctx._source.age += 5"
}
GET /customer/_doc/1?pretty
 
#删除ID为2的文档
GET /customer/_doc/2?pretty
DELETE /customer/_doc/2?pretty
GET /customer/_doc/2?pretty
 
#批处理
GET /customer/_doc/1?pretty
GET /customer/_doc/2?pretty
POST /customer/_doc/_bulk?pretty
{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }
GET /customer/_doc/1?pretty
GET /customer/_doc/2?pretty
POST /customer/_doc/_bulk?pretty
{"update":{"_id":"1"}}
{"doc": { "name": "John Doe becomes Jane Doe" } }
{"delete":{"_id":"2"}}
GET /customer/_doc/1?pretty
GET /customer/_doc/2?pretty
 
#q=*匹配索引中的全部文档
GET /customer/_search?q=*&&pretty
#JSON查询体匹配索引中的全部文档
GET /customer/_search
{
  "query": { "match_all": {} }
}
#size指定查询文档大小,若未指定,则默认为10
GET /customer/_search
{
  "query": { "match_all": {} },
  "size": 1
}
#from参数(基于0)指定从哪个文档索引开始,size参数指定从from参数开始返回多少文档
#这个特性在实现搜索结果分页时非常有用!注意,如果未指定from,则默认为0
GET /customer/_search
{
  "query": { "match_all": {} },
  "from": 10,
  "size": 10
}
#此示例执行match_all并按帐户余额降序对结果进行排序,并返回前10个(默认大小)文档
GET /bank/_search
{
  "query": { "match_all": {} },
  "sort": { "balance": { "order": "desc" } }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值