美文网首页
Elasticsearch简单的语句

Elasticsearch简单的语句

作者: 我是晓梦啊 | 来源:发表于2021-12-30 14:36 被阅读0次

获取一个document

#id是数据的id
curl -X GET http://localhost:9200/index/type/<id>

获取同一type的所有元素

curl -X GET http://localhost:9200/index/type/_search

新增一个document

可以使用POST或PUT请求。

curl -H "Content-Type: application/json" -XPOST  http://localhost:9200/index/type/11 -d '
{
    "error": "Content-Type header [application/x-www-form-urlencoded] is not supported",
    "status": 406
}
'

{}这里里面就是添加的数据,这个我们给的id是11

修改一个document

可以使用POST或PUT请求。

curl -H "Content-Type: application/json" -XPUT  http://localhost:9200/index/type/11 -d '
{
    "error": "Content-Type header [application/x-www-form-urlencoded] is not supported",
    "status": 406
}
'

删除一个document

curl -X DELETE http://localhost:9200/index/type/11

相关文章

网友评论

      本文标题:Elasticsearch简单的语句

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