1.查看es日志
curl -XGET http://10.26.41.60:9200/xdm-logs-2018.08.22?pretty=true

2.删除es日志
curl -XDELETE 'http://10.26.41.60:9200/xdm-logs-2018.08.22?pretty'

3.查询全部,默认返回10条
curl -XPOST '10.26.41.60:9200/xdm-logs-2018.10.22/_search?pretty' -d '
{
"query": { "match_all": {} }
}'

按照updateTime降序返回第一条
curl -H "Content-Type: application/json" -XPOST 'http://10.29.69.243:19200/inoculate/_search?pretty' -d '
{
"query": { "match_all": {} },
"sort": { "updateTime": { "order": "desc" } },
"size": 1
}'

4.查询_id为AWaZRBLvqKSJQKtyjFBL的数据
curl -XPOST '10.26.41.60:9200/xdm-logs-2018.10.22/_search?pretty' -d '
{
"query": { "match": { "_id": "AWaZRBLvqKSJQKtyjFBL" } }
}'

curl -H "Content-Type: application/json" -XPOST 'http://10.29.69.243:19200/inoculate/_search?pretty' -d '
{
"query": { "match": { "childId": "5477456" } }
}'

5.模糊查询
curl -XPOST '10.26.41.60:9200/xdm-logs-2018.10.22/_search?pretty' -d '
{
"query": { "wildcard": { "message": "*2697395*" } }
}'

6.查看所有的index
curl -X GET 'http://10.26.41.60:9200/_cat/indices?v'
kettle入库后进行查询
Select
substr(a,1,instr(a,'2018')-2),
sum(Case When d Like '%gb' Then Substr(d,1,Instr(d,'gb')-1)*1024*1024
When d Like '%mb' Then Substr(d,1,Instr(d,'mb')-1)*1024
When d Like '%kb' Then Substr(d,1,Instr(d,'kb')-1)*1
End) As "kb"
From tb_es_data
Group By
substr(a,1,instr(a,'2018')-2)

7.查看某个index的settings,或者mapping,(pretty=true是指使用易读的方式展现结果)

url -H "Content-Type: application/json" -XGET "http://10.26.41.60:9200/nginx-logs-2018.09.05/_settings?pretty=true"
curl -H "Content-Type: application/json" -XGET "http://10.26.41.60:9200/nginx-logs-2018.09.05/_mappings?pretty=true" 这里可以查看分片数和副本数
{
"db_customer" : {
"settings" : {
"index" : {
"creation_date" : "1544423489873",
"number_of_shards" : "5",
"number_of_replicas" : "1",
"uuid" : "l77jcDHsR9miIuIKs7RBAA",
"version" : {
"created" : "6050099"
},
"provided_name" : "db_customer"
}
}
}
}

8.获取节点信息
[yeemiao@elk2 etc]$ curl 'http://10.26.41.60:9200/_cat/nodes?v'

9.查看那个是主节点
curl http://192.168.1.134:9200/_cat/master?v

10.设置副本数(这里把单节点的副本数设置为0)
curl -u elastic:elastic -H "Content-Type: application/json" -XPUT 'http://192.168.1.85:9200/db_customer/_settings' -d '{
"number_of_replicas" : 0
}'

11.创建索引并设置其中的mapping的某个字段不进行index

curl -u elastic:elastic -X PUT "192.168.1.85:9200/mytest_index02" -H 'Content-Type: application/json' -d'
{
"mappings": {
"_doc": {
"properties": {
"title": { "type": "text" },
"name": { "type": "text" ,"index": "false" },
"age": { "type": "integer" },
"created": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
}
}
}
}
}
'

12.创建index,然后创建mapping

创建一个新的index
curl -u elastic:elastic -H 'Content-Type: application/json' -XPUT "http://192.168.1.85:9200/productindex01" 创建一个mapping
curl -u elastic:elastic -H 'Content-Type: application/json' -XPOST "http://192.168.1.85:9200/productindex01/product01/_mapping?pretty" -d '
{
"product01": {
"properties": {
"title": {
"type": "text",
"store": "true"
},
"description": {
"type": "text",
"index": "false"
},
"price": {
"type": "double"
},
"onSale": {
"type": "boolean"
},
"type": {
"type": "integer"
},
"createDate": {
"type": "date"
}
}
}
}
'
添加一个字段:
curl -u elastic:elastic -H 'Content-Type: application/json' -XPOST "http://192.168.1.85:9200/productindex01/product01/_mapping?pretty" -d '{
"product01": {
"properties": {
"amount":{
"type":"integer"
}
}
}
}'

------------------数据库、表、记录操作-----------------------
查看索引(数据库)
curl 'http://192.168.56.91:9200/_cat/indices?v'

创建索引
curl -XPUT 'http://192.168.56.91:9200/db_customer'

添加文档(表)
[esuser@pxc01 ~]$ curl -H "Content-Type: application/json" -XPUT 'http://192.168.56.91:9200/db_customer/tb_test/1' -d '{"name": "huangxueliang"}'

查看刚才添加的文档记录
curl -XGET 'http://192.168.56.91:9200/db_customer/tb_test/1?pretty'
curl -XGET 'http://192.168.56.91:9200/db_customer/tb_test/2?pretty'
curl -XGET 'http://192.168.56.91:9200/db_customer/tb_test/3?pretty'

删除记录
curl -XDELETE 'http://192.168.56.91:9200/db_customer/tb_test/2'

更新文档
curl -H "Content-Type: application/json" -XPOST 'http://192.168.56.91:9200/db_customer/tb_test/1/_update?pretty' -d '
{
"doc":{"name":"myname_update_hxl"}
}'

查看表记录
curl -XGET 'http://10.29.69.243:19200/vacc_update/log/_search?pretty'

红色部分是记录的id
curl -H "Content-Type: application/json" -XPOST 'http://10.29.69.243:19200/vacc_update/log/KxgYJmgBEiGK96VRX--b/_update?pretty' -d '
{
"doc":{"updateTime" : "2018-01-01 00:00:00"}
}'

批处理
curl -H "Content-Type: application/json" -XPOST 'http://192.168.56.91:9200/db_customer/tb_test/_bulk?pretty' -d '
{"index":{"_id":"2"}}
{"name":"zhangsan"}
{"index":{"_id":"3"}}
{"name":"lisi"}
'

查找数据库下的表
curl -XGET "http://192.168.1.134:9200/reservation/_mapping?pretty"

查表里的数据
curl -XGET 'http://192.168.56.91:9200/db_customer/tb_test/_search?pretty'

删除索引
curl -XDELETE 'http://192.168.1.118:9200/db_customer?pretty'

查看mapping的设置
curl -H "Content-Type: application/json" -XGET "http://192.168.1.85:9200/db_customer01/_mappings?pretty=true"

查找某个字段
curl -u elastic:elastic -X GET "192.168.1.85:9200/index_publications/_mapping/_doc/field/title?pretty=true"

es日常维护的更多相关文章

  1. ORACLE分区表梳理系列(二)- 分区表日常维护及注意事项(红字需要留意)

    版权声明:本文发布于http://www.cnblogs.com/yumiko/,版权由Yumiko_sunny所有,欢迎转载.转载时,请在文章明显位置注明原文链接.若在未经作者同意的情况下,将本文内 ...

  2. 数据库日常维护-CheckList_01历史Agent Job执行情况检查

    检查Agent Job中日常维护作业或业务作业是否成功,如每天的备份.碎片整理.索引维护.历史备份文件清除等,可利用SSMS工具,通过CDC下面设置好的DB Server List,运行下面脚本一次, ...

  3. MS SQL 日常维护管理常用脚本(二)

    监控数据库运行 下面是整理.收集监控数据库运行的一些常用脚本,也是MS SQL 日常维护管理常用脚本(一)的续集,欢迎大家补充.提意见. 查看数据库登录名信息   Code Snippet SELEC ...

  4. 2.goldengate日常维护命令(转载)

    goldengate日常维护命令 发表于 2013 年 7 月 4 日 由 Asysdba 1.查看进程状态 GGSCI (PONY) 2> info all 2.查看进程详细状态,有助于排错 ...

  5. db2日常维护

    一. DB2日常维护操作 1.数据库的启动.停止.激活 db2 list active databases db2 active db 数据库名 db2start --启动 db2stop [forc ...

  6. svn服务配置和日常维护命令

    Subversion独立服务和与apache整合服务. 一 .Svn独立服务安装 操作系统: Redhat Linux AS3  AS 4   ContOS AS 4 安装包获取: 下载[url]ht ...

  7. 程序员必备:Oracle日常维护命令

        上一篇讲了Linux的日常维护命令,这篇讲讲Oracle的日常维护命令.工作中需要使用Oracle数据库的童鞋们,相信或多或少都需要对Oracle做一些基本的维护操作,例如导入导出总该有吧?( ...

  8. DB2日常维护——REORG TABLE命令优化数据库性能

    一个完整的日常维护规范可以帮助 DBA 理顺每天需要的操作,以便更好的监控和维护数据库,保证数据库的正常.安全.高效运行,防止一些错误重复发生. 由于DB2使用CBO作为数据库的优化器,数据库对象的状 ...

  9. mha日常维护命令

    mha日常维护命令 http://m.blog.chinaunix.net/uid-28437434-id-3959021.html?/13033.shtml 1.查看ssh登陆是否成功masterh ...

随机推荐

  1. nginx出现 “414 request-uri too large”

    nginx出现 “414 request-uri too large” 在请求查询的时候使用了Get方法,由于拼接的url过长,导致nginx出现了“414 request-uri too large ...

  2. Spring AOP @AspectJ进阶

    @AspectJ可以使用切点函数定义切点,我们还可以使用逻辑运算符对切点进行复核运算得到复合的切点,为了在切面中重用切点,我们还可以对切点进行命名,以便在其他的地方引用定义过的切点.当一个连接点匹配多 ...

  3. 11.8Django中的组件content_type

    2018-11-8 18:59:11 在Django中已经有一个contenttype这个组件,并且在python manage.py makemigrations 和migrate的时候,一起在数据 ...

  4. 6.cookie、session,localStorage、sessionStorage

    必须在服务器下运行 cookie/session 存东西 cookie 时间 过期时间 4k 服务器把一部分数据保存在客户端(浏览器) session 回话 时间 服务器存取用户信息 5M local ...

  5. Eclipse使当前项目依赖另一个项目

    实例说明 在Eclipse中可以创建多个项目实现不同的软件开发,也可以使用多个项目来开发单独的大型软件,每个项目负责单独的模块部门,这样可以使软件的模块分类更清晰,可以单独的维护每个模块部分.但是项目 ...

  6. JS setAttribute兼容

    问题和表现: 最近实践中遇到的问题,setAttribute()设置在IE7中,无法设置style等属性.这样就对设置样式带了很大的困扰,例如绑定点击事件来隐藏元素,setAttribute(”sty ...

  7. Linux上传文件与执行

    ls ——查看文件夹 mkdir——新建文件夹 cd:——进入文件 nohup python3 文件名.py & ——让代码在后台运行 ps -aux | grep 文件——查看进程 ps-a ...

  8. dubbo控制器xml文件报错

    在配置dubbo服务的过程中,经常会遇到虽然程序能够跑起来,但是配置文件一堆红叉,虽然不影响功能,但是确实很让人恶心. 报错信息如下: Multiple annotations found at th ...

  9. webpack的externals的使用

    externals 官网文档解释的很清楚,就是webpack可以不处理应用的某些依赖库,使用externals配置后,依旧可以在代码中通过CMD.AMD或者window/global全局的方式访问. ...

  10. darknet集成遇到的问题以及解决方法

    将darknet集成进工程时,遇到了一些问题,下面记录一下解决方法: 集成步骤: 首先在yolo编译的时候,需要将三个开关打开: #define GPU#define CUDNN#define OPE ...