码迷,mamicode.com
首页 > 其他好文 > 详细

命令用法示例

时间:2019-12-22 10:37:48      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:cse   用法   elastics   oca   sage   需要   type   search   stat   

  • curl命令使用账号密码连接es
curl -XGET -u "elastic:changeme" 'http://localhost:9200/' -H 'Content-Type: application/json'
# -u 选项可以帮我们设置用户名及密码来登录我们的elasticsearch
# -u, --user <user:password> Server user and password

# 若是还需要证书的话则使用如下用法
curl -XGET -u "elastic:changeme" --cacert xxx.cert 'http://localhost:9200/' -H 'Content-Type: application/json'
# 其他参数
--cacert <file> CA certificate to verify peer against
--capath <dir>  CA directory to verify peer against
-cert <certificate[:password]> Client certificate file and password
--cert <certificate[:password]> Client certificate file and password
--cert-status   Verify the status of the server certificate
--cert-type <type> Certificate file type (DER/PEM/ENG)
  • pretty的用法
# 创建索引,最后直接加上pretty
curl -XPUT 'http://localhost:9200/twitter/_doc/1?pretty' -H 'Content-Type: application/json' -d '
{
    "user": "kimchy",
    "post_date": "2009-11-15T13:12:00",
    "message": "Trying out Elasticsearch, so far so good?"
}'

# 查询,最后需要加上pretty=true,注意,跟上面的不一样
curl -XGET 'http://localhost:9200/twitter/_doc/1?pretty=true'

命令用法示例

标签:cse   用法   elastics   oca   sage   需要   type   search   stat   

原文地址:https://www.cnblogs.com/sanduzxcvbnm/p/12079023.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!