- 所需环境
- 安装并成功运行elasticsearch
- 下载postman
- 创建索引
- PUT请求
http://IP地址:端口/索引名称
- 查看单个索引信息
- GET请求
http://IP地址:端口号/索引名称
- 返回结果
{
"xiemaoshu": { // 索引名称
"aliases": {},
"mappings": {},
"settings": { // 设置
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"provided_name": "xiemaoshu",
"creation_date": "1621758118555",
"number_of_replicas": "1",
"uuid": "5mUtFpltRCSZG6r-sPrkYw",
"version": {
"created": "7100099"
}
}
}
}
}
- 查看所有索引列表
- GET请求
http://IP地址:端口号/_cat/indices?v
- 删除索引
- DELETE请求
http://IP地址:端口/索引名称
- POST请求
http://IP地址:端口号/索引名称/_doc
- POST请求
http://IP地址:端口号/索引名称/_doc/ID值
- 查看数据(文档)
- 可以使用唯一ID查看单条数据信息
- GET请求
http://IP地址:端口号/索引名称/_doc/ID
- 查询索引下所有数据
- GET请求
http://IP地址:端口号/索引名称/_search
- 返回结果说明
{
"took": 140,// 总耗时(毫秒)
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"Failed": 0
},
"hits": { // 命中结果
"total": {
"value": 2,// 合计数
"relation": "eq"
},
"max_score": 1.0,
"hits": [ // 命中数据
{
"_index": "xiemaoshu",
"_type": "_doc",
"_id": "m5V0mHkBAtMPfMQ4h4Hl",
"_score": 1.0,
"_source": {
"name": "xms",
"age": 24,
"sex": "男"
}
},
{
"_index": "xiemaoshu",
"_type": "_doc",
"_id": "1001",
"_score": 1.0,
"_source": {
"name": "xms1001",
"age": 24,
"sex": "男"
}
}
]
}
}
- POST请求
http://IP地址:端口/索引名称/ID
- 修改文档中某个字段
- POST请求
http://IP地址:端口/索引名称/_update/文档ID
- 删除文档
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。