获取index和type

1.查看index
curl -X GET 'ip地址:9200/_cat/indices?v'

2.查看type
curl -X GET 'http://ip地址:9200/_mapping?pretty=true'

1.查询数据

curl -X GET "ip地址:9200/index名/type名/id?pretty"
eg:curl -X GET "192.168.61.150:9200/punishment/enterprise/1?pretty"

2.新增数据

curl -X PUT "ip地址:9200/index名/type名/id?pretty" -H 'Content-Type: application/json' -d'{"name": "名称"}'

3.修改数据

curl -X POST "ip地址:9200/index名/type名/id/_update?pretty" -H 'Content-Type: application/json' -d'
{
  "doc": { "name": "名称" }
}'
eg:curl -X POST "192.168.61.150:9200/punishment/enterprise/1/_update?pretty" -H 'Content-Type: application/json' -d'
{
  "doc": { "name": "123456789" }
}'

4.删除数据

curl -X DELETE "ip地址:9200/index名/type名/id?pretty"

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐