Elastic学习

来源:互联网 发布:php读取txt文件前 编辑:程序博客网 时间:2024/06/05 05:17

创建一个index
curl -XPUT 'localhost:9200/customer?pretty&pretty'

查看所有的index
curl -XGET 'localhost:9200/_cat/indices?v&pretty'

创建一个document domain/{index}/{type}/id
curl -XPUT 'localhost:9200/customer/external/1?pretty&pretty' -d'
{
"name": "John Doe"
}'

查看id为1的document
curl -XGET 'localhost:9200/customer/external/1?pretty&pretty'

删除index
curl -XDELETE 'localhost:9200/customer?pretty&pretty'
查看
curl -XGET 'localhost:9200/_cat/indices?v&pretty'

修改限制:vim /etc/security/limits.conf 修改open file 为63356

curl -XPOST 'localhost:9200/customer/external?pretty&pretty' -d'
{
"name": "Jane Doe"
}'

更新:
curl -XPOST 'localhost:9200/customer/external/1/_update?pretty&pretty' -d'
{
"doc": { "name": "Jane Doe" }
}'

命令的格式:
<REST Verb> /<Index>/<Type>/<ID>