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

不知不觉的再坚持一天要周五啦, 周末就要来了。你们嗨起来呀html

下面是我这周目前的总结, 因工做繁忙, 内容比较简单, 但愿你们见谅。数组

命令行经常使用的几个快捷键

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

curl 命令的简单使用

返回头部和内容bash

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

只返回头部curl

curl -I http://www.baidu.com
复制代码
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的增删改查

建立

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
}

复制代码

查询

curl 127.0.0.1:9200/synctest/article/5?pretty
{
  "_index" : "synctest",
  "_type" : "article",
  "_id" : "5",
  "_version" : 1,
  "found" : true,
  "_source" : {
    "name" : "test"
  }
}
复制代码

更新

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
  }
}
复制代码

删除

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
    }
}
复制代码

检查文档是否存在(不返回数据)

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
复制代码

查询不存在的数据url

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或4spa

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 的数组命令行

今天在地铁感受忽然想起忘记一切,查了一路相关锁的概念,后来在《芋道源码》上看到了这幅图,但愿对你们也能有所帮助。

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

相关文章
相关标签/搜索