新增索引
curl -XPUT 'http://localhost:9200/customer'
新增文档:
curl -H "Content-Type: application/json" -XPUT 'http://localhost:9200/customer/external/1' -d '{"name": "John Doe"}'
查询
curl -XGET ‘http://localhost:9200/customer/external/1?pretty’
返回所有记录
curl -XGET 'http://192.168.255.143:9200/customer/external/_search?pretty'
更新文档
curl -H "Content-Type: application/json" -XPOST 'http://localhost:9200/customer/external/1/_update?pretty' -d '
{
"doc":{"name":"lisi"}
}'
// 一定要用 '{"doc":{}}'
批处理
curl -H "Content-Type: application/json" -XPOST 'http://localhost:9200/customer/external/_bulk?pretty' -d '{"index":{"_id":"2"}} {"name":"zhangsan"}{"index":{"_id":"3"}} {"name":"lisi"} ' // enter
网友评论