{
"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": "{
"query": { "match_all": {} },
"sort": [
{ "account_number": "asc" }
],
"from": 1,
"size": 3
}"
},
"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": "{
"query": {
"match": {
"address": "mill lane"
}
}
}"
},
"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": "{
"query": {
"match_phrase": {
"address": "Kings Place"
}
}
}"
},
"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": "{
"query": {
"bool": {
"must": [
{ "match": { "age": "40" } }
],
"must_not": [
{ "match": { "state": "ID" } }
]
}
}
}"
},
"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": "{
"query": {
"bool": {
"must": [
{ "match_phrase": { "address": "mill lane" } }
],
"must_not": [
{ "match": { "age": "40" } }
],
"filter": {
"range": {
"balance": {
"gte": 40000,
"lte": 50000
}
}
}
}
},
"sort": [
{ "account_number": "asc" }
],
"from": 0,
"size": 2
}"
},
"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": "{
"query": {
"bool": {
"must": { "match_all": {} },
"filter": {
"range": {
"balance": {
"gte": 20000,
"lte": 30000
}
}
}
}
}
}"
},
"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": "{
"size": 0,
"aggs": {
"group_by_state": {
"terms": {
"field": "state.keyword"
,"size": 2
}
}
}
}"
},
"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": "{
"size": 0,
"aggs": {
"group_by_state": {
"terms": {
"field": "state.keyword"
},
"aggs": {
"average_balance": {
"avg": {
"field": "balance"
}
}
}
}
}
}"
},
"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": "{
"size": 0,
"query": {
"bool": {
"filter": {
"range": {
"age": {
"gte": 40
}
}
}
}
},
"aggs": {
"group_by_state": {
"terms": {
"field": "state.keyword",
"order": {
"average_balance": "desc"
},
"size": 2,
"shard_size": 4
},
"aggs": {
"average_balance": {
"avg": {
"field": "balance"
}
},
"stats_balance": {
"stats": {
"field": "balance"
}
}
}
}
}
}"
},
"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": "{
"name": "John Doe"
}"
},
"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": "{
"name": "John Doe"
}"
},
"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": []
}
]
}
]
}