美文网首页
2021-06-21 elasticsearch用法

2021-06-21 elasticsearch用法

作者: 罗不错 | 来源:发表于2021-08-16 09:43 被阅读0次

新增索引
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

相关文章

网友评论

      本文标题:2021-06-21 elasticsearch用法

      本文链接:https://www.haomeiwen.com/subject/njhyyltx.html