kibana操作记录
GET _search
{
"query": {
"match_all": {}
}
}
GET _cat/nodes
GET _cat/health
GET _cat/master
GET _cat/indices
GET _cat/indices?v
# 索引一个文档
PUT /customer/_doc/6
{
"name":"Haha"
}
# 查看一个文档
GET /customer/_doc/6
GET /customer
# 更新一个文档
POST customer/_update/6/
{
"doc":{
"name":"Jane",
"age":19
}
}
# 删除一个文档
DELETE customer/_doc/5
# 删除整个索引
DELETE customer
DELETE bank
GET bank/_doc/1
PUT /bank/_doc/_bulk
GET customer/_doc/1
PUT /customer/_bulk
{"index":{"_id":"1"}}
{"name":"John Doe"}
{"index":{"_id":"2"}}
{"name":"Jane"}
# 对整个es操作
PUT /_bulk
{"delete":{"_index":"webset","_id":"123"}}
{"create":{"_index":"webset","_id":"123"}}
{"title":"My first blog post"}
{"index":{"_index":"webset"}}
{"title":"My second blog post"}
{"update":{"_index":"webset","_id":"123"}}
{"doc":{"title":"My updateed blok post"}}
GET _cat/indices?v
DELETE bank
# 通过request uri检索
GET bank/_search?q=*&sort=account_number:desc
GET bank/_search
{
"query": {
"match_all": {}
},
"sort": [
{
"account_number": "desc"
},
{
"balance": "desc"
}
]
}
GET /
GET bank/_search
{
"query": {
"match_all": {}
},
"sort": [
{
"account_number": {
"order": "desc"
}
}
]
}
# match
GET bank/_search
{
"query": {
"match": {
"address": "mill lane"
}
}
}
# match_phrase
GET bank/_search
{
"query": {
"match_phrase": {
"address": "mill lane"
}
}
}
# multi_match 在某个字段里面匹配 分词
GET bank/_search
{
"query": {
"multi_match": {
"query": "mill Movico",
"fields": ["address", "city"]
}
}
}
# bool复合查询
GET bank/_search
{
"query": {
"bool": {
"must": [
{"match": {
"gender": "M"
}},
{
"match": {
"address": "mill"
}
}
],
"must_not": [
{"match": {
"age": 28
}}
],
"should": [
{"match": {
"lastname": "Holland"
}}
]
}
}
}
# filter
# 年龄在18-30
GET bank/_search
{
"query": {
"bool": {
"must": [
{"range": {
"age": {
"gte": 18,
"lte": 30
}
}}
]
}
}
}
# filter不贡献相关性得分,可以对结果直接过滤
GET bank/_search
{
"query": {
"bool": {
"filter": [
{"range": {
"age": {
"gte": 18,
"lte": 30
}
}}
]
}
}
}
# 精确匹配字段值
GET bank/_search
{
"query": {
"term": {
"age":28
}
}
}
# match_phrase不分词查询
GET bank/_search
{
"query": {
"match_phrase": {
"address": "mill lane"
}
}
}
# 使用keyword精确完整匹配
GET bank/_search
{
"query": {
"match": {
"address.keyword": "198 Mill Lane"
}
}
}
# 搜索地址中含有mill的所有人的年龄分布terms、平均年龄avg、平均薪资
GET bank/_search
{
"query": {
"match": {
"address": "mill"
}
},
"aggs": {
"ageAgg": {
"terms": {
"field": "age",
"size": 10
}
},
"ageAvg":{
"avg": {
"field": "age"
}
},
"balanceAvg":{
"avg": {
"field": "balance"
}
}
},
"size": 0
}
# 求所有人的年龄分布、各年龄分布的平均值、工资平均值(子聚合)
GET bank/_search
{
"query": {
"match_all": {}
},
"aggs": {
"ageAgg": {
"terms": {
"field": "age",
"size": 100
},
"aggs": {
"ageAvg": {
"avg": {
"field": "age"
}
},
"balanceAvg":{
"avg": {
"field": "balance"
}
}
}
}
},
"size": 0
}
# 求所有人的年龄分布、各年龄分布中M和F的平均薪资及这个年龄段的总体平均薪资
GET bank/_search
{
"query": {
"match_all": {}
},
"aggs": {
"ageAgg": {
"terms": {
"field": "age",
"size": 100
},
"aggs": {
"balanceAvg": {
"avg": {
"field": "balance"
}
},
"genderAgg": {
"terms": {
"field": "gender.keyword",
"size": 10
},
"aggs": {
"balanceAvg": {
"avg": {
"field": "balance"
}
}
}
}
}
}
},
"size": 0
}
# mapping 字段的类型,决定了如何处理数据
# 查看映射
GET bank/_mapping
DELETE my_index
# 创建映射 keyword不进行分词,text分词,index默认为true(是否可被检索)
PUT my_index
{
"mappings": {
"properties": {
"age":{"type": "integer"},
"email":{"type": "keyword"},
"name":{"type": "text","index": true}
}
}
}
GET my_index/
# 添加映射
PUT my_index/_mapping
{
"properties":{
"employee_id": {
"type":"keyword",
"index":"false"
}
}
}
DELETE my_index
GET bank/_mapping
PUT newbank
{
"mappings": {
"properties": {
"account_number": {
"type": "long"
},
"address": {
"type": "text"
},
"age": {
"type": "integer"
},
"balance": {
"type": "long"
},
"city": {
"type": "keyword"
},
"email": {
"type": "keyword"
},
"employer": {
"type": "keyword"
},
"firstname": {
"type": "keyword"
},
"gender": {
"type": "keyword"
},
"lastname": {
"type": "keyword"
},
"state": {
"type": "text"
}
}
}
}
GET bank/_search
# 迁移数据
POST _reindex
{
"source": {
"index": "bank"
},
"dest": {
"index": "newbank"
}
}
GET newbank/_search
# 分词 无法分割中文
POST _analyze
{
"analyzer": "standard",
"text": ["hello你好"]
}
# 使用ik分词器
POST _analyze
{
"analyzer": "ik_smart",
"text": ["我是中国人"]
}
POST _analyze
{
"analyzer": "ik_max_word",
"text": ["我是中国人"]
}
POST _analyze
{
"analyzer": "ik_smart",
"text": ["乔碧萝殿下天大我地大"]
}
kibana操作记录的更多相关文章
- centos 6x系统下源码安装mysql操作记录
在运维工作中经常部署各种运维环境,涉及mysql数据库的安装也是时常需要的.mysql数据库安装可以选择yum在线安装,但是这种安装的mysql一般是系统自带的,版本方面可能跟需求不太匹配.可以通过源 ...
- Mysql更换MyISAM存储引擎为Innodb的操作记录
一般情况下,mysql会默认提供多种存储引擎,可以通过下面的查看: 1)查看mysql是否安装了innodb插件.通过下面的命令结果可知,已经安装了innodb插件. mysql> show p ...
- nginx缓存配置的操作记录梳理
web缓存位于内容源Web服务器和客户端之间,当用户访问一个URL时,Web缓存服务器会去后端Web源服务器取回要输出的内容,然后,当下一个请求到来时,如果访问的是相同的URL,Web缓存服务器直接输 ...
- Linux下修改系统编码的操作记录
Linux系统安装后,发现中文显示乱码.因为系统编码为en_US.UTF-8,应改为支持中文的编码(即zh_CN.UTF-8)操作记录如下:1)检查linux的系统编码检查linux的系统编码,确定系 ...
- Nginx中防盗链(下载防盗链和图片防盗链)操作记录
日常运维工作中,设置防盗链的需求会经常碰到,这也是优化网站的一个必要措施.今天在此介绍Nginx中设置下载防盗链和图片防盗链的操作~ 一.Nginx中下载防盗链的操作记录对于一些站点上的下载操作,有很 ...
- nginx利用geo模块做限速白名单以及geo实现全局负载均衡的操作记录
geo指令使用ngx_http_geo_module模块提供的.默认情况下,nginx有加载这个模块,除非人为的 --without-http_geo_module.ngx_http_geo_modu ...
- Mysql备份系列(4)--lvm-snapshot备份mysql数据(全量+增量)操作记录
Mysql最常用的三种备份工具分别是mysqldump.Xtrabackup(innobackupex工具).lvm-snapshot快照.前面分别介绍了:Mysql备份系列(1)--备份方案总结性梳 ...
- jenkins中通过git发版操作记录
之前说到的jenkins自动化构建发版是通过svn方式,今天这里介绍下通过git方式发本的操作记录. 一.不管是通过svn发版还是git发版,都要首先下载svn或git插件.登陆jenkins,依次点 ...
- gitlab配置邮件通知功能操作记录
之前已经介绍了gitlab的部署http://www.cnblogs.com/kevingrace/p/5651402.html但是没有配置邮箱通知功能,今天这里介绍下gitlab安装后的邮箱配置操作 ...
随机推荐
- 云原生新时代弄潮儿k8s凭什么在容器化方面独树一帜?
云原生新时代弄潮儿k8s凭什么在容器化方面独树一帜? Kubernetes 可以为做些什么? 在学习一种新技能之前,囧囧建议不要上去先看各种牛叉的实现,我们需要先搞清楚这个技能是什么?学习了之后能为我 ...
- 带你十天轻松搞定 Go 微服务系列(五)
序言 我们通过一个系列文章跟大家详细展示一个 go-zero 微服务示例,整个系列分十篇文章,目录结构如下: 环境搭建 服务拆分 用户服务 产品服务 订单服务(本文) 支付服务 RPC 服务 Auth ...
- 推荐召回--基于内容的召回:Content Based
目录 1. 前言 2. 构建画像 3. 内容召回的算法 1. 前言 在之前总结过协同过滤的召回通路后,今天我们来总结下召回策略中的重头戏:基于内容的召回通路,也即我们常说的基于标签的召回.这里就要涉及 ...
- 学习Java第14天
今天成功安装了MySQL Visual Studio Code 准备试着学习HTML+CSS了 明天开始认识HTML和CSS学会软件的使用 今天安装调试这些东西属实费了点劲,可能电脑配置较低吧,还有点 ...
- 学习Java第2天
今天所做的工作: 1.学习Java语言变量的使用 2.学习Java语言的算数运算符及逻辑运算符 3.学习选择结构 4.编程检验学习成果 明天工作安排: 1.循环结构 2.字符串 3.数组 4.面向对象 ...
- 计算机电子书 2020 CDNDrive 备份(预览版 II)
下载方式 pip install CDNDrive # 或 # pip install git+https://github.com/apachecn/CDNDrive cdrive download ...
- tcp 中 FLAGS字段,几个标识:SYN, FIN, ACK, PSH, RST, URG.
在TCP层,有个FLAGS字段,这个字段有以下几个标识:SYN, FIN, ACK, PSH, RST, URG. 其中,对于我们日常的分析有用的就是前面的五个字段.它们的含义是: 1.SYN表示建立 ...
- 模仿系统的UIImageView
整体思路: 我们想要模仿系统的UIImageView,我们必须得要知道系统的UIView怎么用. 系统的用法是创建一个UIImageView对象,设置frame,给它传递一个UIIma ...
- 深入了解Element Form表单动态验证问题 转载
随风丶逆风 2020-04-03 15:36:41 2208 收藏 3 分类专栏: Vue 随笔 文章标签: 动态验证 el-form elementUI 表单验证 版权 在上一篇<vue ...
- python中一个经典的参数错误
直接上代码 class Company: def __init__(self, name, staffs=[]): self.name = name self.staffs = staffs def ...