前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >快捷键、curl命令、es简单使用、锁

快捷键、curl命令、es简单使用、锁

作者头像
用户2825413
发布2019-07-15 20:27:07
6700
发布2019-07-15 20:27:07
举报

下面是我这周目前的总结, 因工作繁忙, 内容比较简单, 希望大家见谅。

命令行常用的几个快捷键

代码语言:javascript
复制
ctrl+a:跳到本行的行首
ctrl+e:跳到页尾
Ctrl+u:删除当前光标前面的文字 (还有剪切功能)
ctrl+k:删除当前光标后面的文字(还有剪切功能)
Ctrl+L:进行清屏操作
Ctrl+y:粘贴Ctrl+u或ctrl+k剪切的内容
Ctrl+w:删除光标前面的单词的字符

curl 命令的简单使用

返回头部和内容

代码语言:javascript
复制
curl -i http://www.baidu.co

只返回头部

代码语言:javascript
复制
curl -I http://www.baidu.com
代码语言:javascript
复制
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: Keep-Alive
Content-Length: 277
Content-Type: text/html
Date: Wed, 13 Mar 2019 08:42:40 GMT
Etag: "575e1f60-115"
Last-Modified: Mon, 13 Jun 2016 02:50:08 GMT
Pragma: no-cache
Server: bfe/1.0.8.18

关于es的增删改查

创建
代码语言:javascript
复制
curl -X PUT 127.0.0.1:9200/synctest/article/5/
_create?pretty -d '{"name":"test"}'
{
  "_index" : "synctest",
  "_type" : "article",
  "_id" : "5",
  "_version" : 1,
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "created" : true
}
查询
代码语言:javascript
复制
curl 127.0.0.1:9200/synctest/article/5?pretty
{
  "_index" : "synctest",
  "_type" : "article",
  "_id" : "5",
  "_version" : 1,
  "found" : true,
  "_source" : {
    "name" : "test"
  }
}
更新
代码语言:javascript
复制
curl -X POST 127.0.0.1:9200/synctest/article/5/_update?pretty -d '
{"doc":{"idx":"cc"}}'

{
  "_index" : "synctest",
  "_type" : "article",
  "_id" : "5",
  "_version" : 2,
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  }
}
删除
代码语言:javascript
复制
curl -X DELETE 127.0.0.1:9200/synctest/article/5

{
    "found":true,
    "_index":"synctest",
    "_type":"article",
    "_id":"5",
    "_version":2,
    "_shards":{
        "total":2,
        "successful":1,
        "failed":0
    }
}
检查文档是否存在(不返回数据)
代码语言:javascript
复制
curl -i -X HEAD 127.0.0.1:9200/synctest/article/5?pretty

HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Length: 0

查询不存在的数据

代码语言:javascript
复制
curl -I -X HEAD 127.0.0.1:9200/synctest/article/66?pretty

HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=UTF-8
Content-Length: 0
批量查询

查询id=3或4

代码语言:javascript
复制
curl -X POST 127.0.0.1:9200/synctest/article/_mget?pretty -d '{"id
s":["3","4"]}'

{
  "docs" : [ {
    "_index" : "synctest",
    "_type" : "article",
    "_id" : "3",
    "_version" : 2,
    "found" : true,
    "_source" : {
      "id" : 3,
      "is_deleted" : 0,
      "name" : "5333",
      "update_time" : "2018-11-02T11:13:33+08:00"
    }
  }, {
    "_index" : "synctest",
    "_type" : "article",
    "_id" : "4",
    "_version" : 14,
    "found" : true,
    "_source" : {
      "id" : 4,
      "cc" : 1,
      "views" : 6
    }
  } ]
}

ids 表示 id 的数组

今天在地铁感觉突然忘记好多,查了一路相关锁的概念,后来在《芋道源码》上看到了这幅图,希望对大家也能有所帮助。

接下来会寻找机会摸鱼, 整理更多的东西分享出来

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-03-14,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 呆呆熊的技术路 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 命令行常用的几个快捷键
  • curl 命令的简单使用
  • 关于es的增删改查
    • 创建
      • 查询
        • 更新
          • 删除
            • 检查文档是否存在(不返回数据)
              • 批量查询
              • 今天在地铁感觉突然忘记好多,查了一路相关锁的概念,后来在《芋道源码》上看到了这幅图,希望对大家也能有所帮助。
              领券
              问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档