{
"info": {
"_postman_id": "7745c9e1-e87f-4385-adc9-16bc2ea8efc0",
"name": "es7.7.0",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "获取",
"item": [
{
"name": "分页排序获取",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n "query": { "match_all": {} },\r\n "sort": [\r\n { "account_number": "asc" }\r\n ],\r\n "from": 1,\r\n "size": 3\r\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_search?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_search"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
},
{
"name": "获取指定主键",
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://{{http_ip_port}}/customer/_doc/1?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"customer",
"_doc",
"1"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
},
{
"name": "获取指定单词",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n "query": {\n "match": {\n "address": "mill lane"\n }\n }\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_search?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_search"
],
"query": [
{
"key": "pretty",
"value": null
}
]
},
"description": "单词可多个,空格隔开,每个单词都是独立搜索"
},
"response": []
},
{
"name": "获取指定内容",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n "query": {\n "match_phrase": {\n "address": "Kings Place"\n }\n }\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_search?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_search"
],
"query": [
{
"key": "pretty",
"value": null
}
]
},
"description": "match_phrase是查找短语,会将搜索内容作为整体进行匹配,对于field来说仍然是模糊匹配,这个例子类比mysql中的 address like '%mill lane%'"
},
"response": []
},
{
"name": "多条件获取",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n "query": {\r\n "bool": {\r\n "must": [\r\n { "match": { "age": "40" } }\r\n ],\r\n "must_not": [\r\n { "match": { "state": "ID" } }\r\n ]\r\n }\r\n }\r\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_search?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_search"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
},
{
"name": "多条件获取1",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n "query": {\r\n "bool": {\r\n "must": [\r\n \t{ "match_phrase": { "address": "mill lane" } }\r\n ],\r\n "must_not": [\r\n { "match": { "age": "40" } }\r\n ],\r\n "filter": {\r\n "range": {\r\n "balance": {\r\n "gte": 40000,\r\n "lte": 50000\r\n }\r\n }\r\n }\r\n }\r\n },\r\n "sort": [\r\n { "account_number": "asc" }\r\n ],\r\n "from": 0,\r\n "size": 2\r\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_search?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_search"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
},
{
"name": "过滤器获取",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n "query": {\r\n "bool": {\r\n "must": { "match_all": {} },\r\n "filter": {\r\n "range": {\r\n "balance": {\r\n "gte": 20000,\r\n "lte": 30000\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_search?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_search"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
},
{
"name": "聚合查询",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n "size": 0,\r\n "aggs": {\r\n "group_by_state": {\r\n "terms": {\r\n "field": "state.keyword"\r\n ,"size": 2\r\n }\r\n \r\n }\r\n \r\n }\r\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_search?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_search"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
},
{
"name": "复杂聚合查询1-分组求和",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n "size": 0,\r\n "aggs": {\r\n "group_by_state": {\r\n "terms": {\r\n "field": "state.keyword"\r\n },\r\n "aggs": {\r\n "average_balance": {\r\n "avg": {\r\n "field": "balance"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_search?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_search"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
},
{
"name": "复杂聚合查询2-分组求和排序",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n "size": 0,\n "query": {\n "bool": {\n "filter": {\n "range": {\n "age": {\n "gte": 40\n }\n }\n }\n }\n },\n "aggs": {\n "group_by_state": {\n "terms": {\n "field": "state.keyword",\n "order": {\n "average_balance": "desc"\n },\n "size": 2,\n "shard_size": 4\n },\n "aggs": {\n "average_balance": {\n "avg": {\n "field": "balance"\n }\n },\n "stats_balance": {\n "stats": {\n "field": "balance"\n }\n }\n }\n }\n }\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_search?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_search"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
}
]
},
{
"name": "插入",
"item": [
{
"name": "插入索引",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n "name": "John Doe"\r\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/customer/_doc/1?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"customer",
"_doc",
"1"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
},
{
"name": "批量插入索引",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "file",
"file": {}
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_bulk?pretty&refresh",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_bulk"
],
"query": [
{
"key": "pretty",
"value": null
},
{
"key": "refresh",
"value": null
}
]
}
},
"response": []
},
{
"name": "插入指定id数据",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{"account_number":1047,"balance":164118,"firstname":"Elinor1","lastname":"Ratliff1","age":38,"gender":"M","address":"283 Kings Place","employer":"Scentric1","email":"elinorratliff@scentric.com","city":"Ribera","state":"WA"}"
},
"url": {
"raw": "http://{{http_ip_port}}/bank/_doc/1047",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"bank",
"_doc",
"1047"
]
}
},
"response": []
},
{
"name": "更新数据",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n "name": "John Doe"\r\n}"
},
"url": {
"raw": "http://{{http_ip_port}}/customer/_doc?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"customer",
"_doc"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
}
]
},
{
"name": "es信息",
"item": [
{
"name": "查看集群索引信息",
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://{{http_ip_port}}/_cat/indices?v",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"_cat",
"indices"
],
"query": [
{
"key": "v",
"value": null
}
]
}
},
"response": []
},
{
"name": "查看集群状态",
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://{{http_ip_port}}/_cat/health?v",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"_cat",
"health"
],
"query": [
{
"key": "v",
"value": null
}
]
}
},
"response": []
}
]
},
{
"name": "删除",
"item": [
{
"name": "删除指定id",
"request": {
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://{{http_ip_port}}/customer/_doc/1?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"customer",
"_doc",
"1"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
},
{
"name": "删除索引",
"request": {
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://{{http_ip_port}}/customer?pretty",
"protocol": "http",
"host": [
"{{http_ip_port}}"
],
"path": [
"customer"
],
"query": [
{
"key": "pretty",
"value": null
}
]
}
},
"response": []
}
]
}
]
}