ElasticSearch index&document基本操作,附带postman导出文件
2021-06-02 22:10
204 查看
index
创建index
获取index详情
获取所有es中的index
删除index
document
创建document
需要注意的是,post请求创建document的时候,是不满足幂等性的,每一次请求都是创建一个新的document。在没有明确指定id的情况下,每一个创建的document都会自动分配一个唯一id。
指定id创建document
获取某个document的信息
获取所有document
删除指定的document
全量修改指定document
修改指定document的某个属性
postman导出文件内容
{ "info": { "_postman_id": "96f242ab-9ed9-4540-9fde-9feec40b1791", "name": "ElasticSearch", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "base option", "item": [ { "name": "index options", "item": [ { "name": "get all index", "request": { "method": "GET", "header": [], "url": { "raw": "http://127.0.0.1:9200/_cat/indices?v", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "_cat", "indices" ], "query": [ { 20000 "key": "v", "value": null } ] } }, "response": [] }, { "name": "delete index", "request": { "method": "DELETE", "header": [], "url": { "raw": "http://127.0.0.1:9200/shopping", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping" ] } }, "response": [] }, { "name": "create index", "request": { "method": "PUT", "header": [], "url": { "raw": "http://127.0.0.1:9200/shopping", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping" ] } }, "response": [] }, { "name": "get index", "request": { "method": "GET", "header": [], "url": { "raw": "http://127.0.0.1:9200/shopping", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping" ] } }, "response": [] } ] }, { "name": "document options", "item": [ { "name": "create document", "protocolProfileBehavior": { "disabledSystemHeaders": {} }, "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"title\" : \"小米10\",\r\n \"brand\" : \"小米\",\r\n \"price\" : 4000\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://127.0.0.1:9200/shopping/_doc", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping", "_doc" ] } }, "response": [] }, { "name": "get document info", "request": { "method": "GET", "header": [], "url": { "raw": "http://127.0.0.1:9200/shopping/_doc/7pbvzHkBYAUbzfBKmCoR", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping", "_doc", "7pbvzHkBYAUbzfBKmCoR" ] } }, "response": [] }, { "name": "get all document", "request": { "method": "GET", "header": [], "url": { "raw": "http://127.0.0.1:9200/shopping/_search", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping", "_search" ] } }, "response": [] }, { "name": "update document all content", "request": { "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"title\" : \"小米11\",\r\n \"brand\" : \"小米\",\r\n \"price\" : 4001\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://127.0.0.1:9200/shopping/_doc/7pbvzHkBYAUbzfBKmCoR", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping", "_doc", "7pbvzHkBYAUbzfBKmCoR" ] } }, "response": [] }, { "name": "update document", "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"doc\" : {\r\n \"title\" : \"小米30\"\r\n }\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://127.0.0.1:9200/shopping/_update/7pbvzHkBYAUbzfBKmCoR", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping", "_update", "7pbvzHkBYAUbzfBKmCoR" ] } }, "response": [] }, { "name": "delete document", "request": { "method": "DELETE", "header": [], "url": { "raw": "http://127.0.0.1:9200/shopping/_doc/7ZbvzHkBYAUbzfBKhCoL", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping", "_doc", "7ZbvzHkBYAUbzfBKhCoL" ] } }, "response": [] }, { "name": "create document with id", "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"title\" : \"小米10\",\r\n \"brand\" : \"小米\",\r\n \"price\" : 4000\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://127.0.0.1:9200/shopping/_doc/123abc", "protocol": "http", "host": [ "127", "0", "0", "1" ], "port": "9200", "path": [ "shopping", "_doc", "123abc" ] } }, "response": [] } ] } ] } ] }
相关文章推荐
- 二、ElasticSearch基本操作
- elasticsearch基本读写操作
- Elasticsearch之基本操作
- JAVA IO流 <一>文件基本操作
- 输入输出流(IO)—文件字符流(FileReader & FileWriter)的基本操作及应用
- 输入输出流(IO)—文件字节流(FileInputStream & FileOutputStream)的基本操作及运用
- Postman安装、基本操作、高级用法(用例管理、断言、全局/环境变量、请求前置脚本、参数关联、批量执行测试用例、引入外部数据文件、postman生成测试报
- 基本文件操作&fopen函数&FILE指针&ftell &fseek&rewind&fgets文件复制&feof
- elasticsearch报错:org.elasticsearch.index.engine.DocumentMissingException:document missing
- Oracle10g技术问题总结(四)SQL的基本操作、脚本文件操作、数据的自动化导出
- Elasticsearch之基本操作
- elasticsearch indices.recovery 流程分析(索引的_open操作也会触发recovery)——主分片recovery主要是从translog里恢复之前未写完的index,副分片recovery主要是从主分片copy segment和translog来进行恢复
- Linux:目录&文件基本操作
- ElasticSearch RestHighLevelClient 教程(二) 操作index
- android&nbsp;apk文件导出(签名版)
- Linux文件基本操作
- C# 用Linq的方式实现对Xml文件的基本操作(创建xml文件、增删改查xml文件节点信息)
- ElasticSearch索引的相关操作---javaEE--SpringDataElasticSearch
- linux系统基本操作——不同系统之间的文件传输
- 【Linux基础学习之一】关于Linux的一些基本操作(linux登陆、口令文件、多终端登陆)