postman 测试elasticsearch 导出json
{ "info": { "_postman_id": "9b2a03a6-d61d-4819-bdf8-1f0a5b2e7b00", "name": "es", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "indexsearch", "request": { "method": "POST", "header": [], "body": { "mode": "urlencoded", "urlencoded": [] }, "url": { "raw": "http://192.168.8.202:9200/test-1/_search", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1", "_search" ] } }, "response": [] }, { "name": "ik_max_word", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "basic", "basic": [ { "key": "password", "value": "123456", "type": "string" }, { "key": "username", "value": "elastic", "type": "string" } ] }, "method": "GET", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"analyzer\":\"ik_max_word\",\r\n \"text\":\"中华人民共和国国歌\"\r\n}\r\n", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/_analyze", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_analyze" ] } }, "response": [] }, { "name": "ik_smart", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"analyzer\":\"ik_smart\",\r\n \"text\":\"中华人民共和国国歌\"\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/_analyze", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_analyze" ] } }, "response": [] }, { "name": "queryindex", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/test-1", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1" ] } }, "response": [] }, { "name": "http://192.168.8.202:9200/test-2", "request": { "method": "DELETE", "header": [], "url": { "raw": "http://192.168.8.202:9200/test-1", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1" ] } }, "response": [] }, { "name": "创建索引", "request": { "auth": { "type": "basic", "basic": [ { "key": "password", "value": "123456", "type": "string" }, { "key": "username", "value": "elastic", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\r\n\t\"settings\":{\r\n\t\t\"number_of_shards\": \"5\",\r\n\t\t\"number_of_replicas\": \"1\"\r\n\t},\r\n\t\"mappings\": {\r\n\t\t\"stream_line\":{\r\n\t\t\t\"properties\":{\r\n\t\t\t\t\"stream_line_id\":{\r\n\t\t\t\t\t\"type\":\"keyword\",\r\n\t\t\t\t\t\"index\": \"not_analyzed\",\r\n\t\t\t\t\t\"store\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"name\":{\r\n\t\t\t\t\t\"type\":\"string\",\r\n\t\t\t\t\t\"index\": \"ik_smart\",\r\n\t\t\t\t\t\"store\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"area_id\":{\r\n\t\t\t\t\t\"index\": \"ik_smart\",\r\n\t\t\t\t\t\"type\":\"text\",\r\n\t\t\t\t\t\"store\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"spec_id\":{\r\n\t\t\t\t\t\"index\": \"not_analyzed\",\r\n\t\t\t\t\t\"type\":\"string\",\r\n\t\t\t\t\t\"store\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"vpl_id\":{\r\n\t\t\t\t\t\"index\": \"not_analyzed\",\r\n\t\t\t\t\t\"type\":\"text\",\r\n\t\t\t\t\t\"store\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"status\":{\r\n\t\t\t\t\t\"index\": \"not_analyzed\",\r\n\t\t\t\t\t\"type\":\"integer\",\r\n\t\t\t\t\t\"store\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"start_time\":{\r\n\t\t\t\t\t\"type\":\"date\",\r\n\t\t\t\t\t\"format\":\"yyyy-MM-dd HH-mm-ss||yyyy-MM-dd||epoch_millis\",\r\n\t\t\t\t\t\"index\": \"not_analyzed\",\r\n\t\t\t\t\t\"store\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"end_time\":{\r\n\t\t\t\t\t\"type\":\"date\",\r\n\t\t\t\t\t\"format\":\"yyyy-MM-dd HH-mm-ss||yyyy-MM-dd||epoch_millis\",\r\n\t\t\t\t\t\"index\": \"not_analyzed\",\r\n\t\t\t\t\t\"store\": true\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n }\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/commodity2", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "commodity2" ] } }, "response": [] }, { "name": "创建索引映射", "request": { "auth": { "type": "basic", "basic": [ { "key": "password", "value": "123456", "type": "string" }, { "key": "username", "value": "elastic", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"mappings\" : {\r\n \"properties\":{\r\n \"id\":{\r\n \"type\":\"text\"\r\n },\r\n \"name\":{\r\n \"type\":\"text\",\r\n \"analyzer\": \"ik_max_word\",\r\n \"search_analyzer\": \"ik_max_word\"\r\n \r\n },\r\n \"content\":{\r\n \"type\":\"text\",\r\n \"analyzer\": \"ik_max_word\",\r\n \"search_analyzer\": \"ik_max_word\"\r\n },\r\n \"createdate\":{\r\n \"type\":\"date\"\r\n }\r\n }\r\n }\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/test-1", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1" ] } }, "response": [] }, { "name": "查询所有动态模板", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/_template", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_template" ] } }, "response": [] }, { "name": "查询某个模板", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/_template/test_template_default", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_template", "test_template_default" ] } }, "response": [] }, { "name": "查询映射", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/test-1/_mapping?pretty", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1", "_mapping" ], "query": [ { "key": "pretty", "value": null } ] } }, "response": [] }, { "name": "创建索引模板", "request": { "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"index_patterns\":[\r\n \"template-*\"\r\n ],\r\n \"settings\":{\r\n \"number_of_replicas\":1,\r\n \"refresh_interval\":\"10s\",\r\n \"index.search.slowlog.threshold.query.warn\": \"10s\",\r\n \"index.search.slowlog.threshold.query.info\": \"5s\",\r\n \"index.search.slowlog.threshold.query.debug\": \"2s\",\r\n \"index.search.slowlog.threshold.query.trace\": \"500ms\"\r\n },\r\n \"mappings\": {\r\n \"properties\": { \r\n \"@timestamp\": { \r\n \"type\": \"date\", \r\n \"format\": \"yyyy-MM-dd HH:mm:ss\"\r\n },\r\n \"@version\": {\r\n \"index\": \"false\", \r\n \"type\": \"text\" \r\n },\r\n \"logLevel\": {\r\n \"type\": \"long\"\r\n }\r\n }\r\n },\r\n \"order\":0\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/_template/test_template_default", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_template", "test_template_default" ] } }, "response": [] }, { "name": "创建索引模板", "request": { "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"index_patterns\":[\r\n \"template-test*\"\r\n ],\r\n \"settings\":{\r\n \"number_of_replicas\":1,\r\n \"number_of_shards\":3,\r\n \"refresh_interval\":\"20s\",\r\n \"index.search.slowlog.threshold.query.warn\": \"10s\",\r\n \"index.search.slowlog.threshold.query.info\": \"5s\",\r\n \"index.search.slowlog.threshold.query.debug\": \"2s\",\r\n \"index.search.slowlog.threshold.query.trace\": \"500ms\"\r\n },\r\n \"mappings\": {\r\n \"date_detection\": false, \r\n \"properties\": {\r\n \"@version\": {\r\n \"type\": \"keyword\" \r\n },\r\n \"logLevel\": {\r\n \"type\": \"long\"\r\n }\r\n }\r\n },\r\n \"order\":1\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/_template/test_template_demo", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_template", "test_template_demo" ] } }, "response": [] }, { "name": "_index_template创建demo1", "request": { "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"index_patterns\" : [\"te*\"],\r\n \"priority\" : 1,\r\n \"template\": {\r\n \"settings\" : {\r\n \"number_of_shards\" : 2\r\n }\r\n }\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/_index_template/template_1", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_index_template", "template_1" ] } }, "response": [] }, { "name": "删除模板", "request": { "method": "DELETE", "header": [], "url": { "raw": "http://192.168.8.202:9200/_template/test-1", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_template", "test-1" ] } }, "response": [] }, { "name": "获取所有索引模板", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/_index_template", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_index_template" ] } }, "response": [] }, { "name": "查询某个索引模板信息", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/_index_template/test-1", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_index_template", "test-1" ] } }, "response": [] }, { "name": "索引模板是否存在", "request": { "method": "HEAD", "header": [], "url": { "raw": "http://192.168.8.202:9200/_index_template/test-1\n", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_index_template", "test-1\n" ] } }, "response": [] }, { "name": "删除索引模板", "request": { "method": "DELETE", "header": [], "url": { "raw": "http://192.168.8.202:9200/_index_template/test-1", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_index_template", "test-1" ] } }, "response": [] }, { "name": "创建或更新 索引模板", "request": { "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\r\n\t\"index_patterns\": [\r\n\t\t\"test-1\"\r\n\t],\r\n\t\"template\": {\r\n\t\t\"settings\": {\r\n\t\t\t\"number_of_shards\": 1,\r\n\t\t\t\"number_of_replicas\": 0\r\n\t\t},\r\n\t\t\"mappings\": {\r\n\t\t\t\"properties\": {\r\n\t\t\t\t\"id\": {\r\n\t\t\t\t\t\"type\": \"keyword\",\r\n\t\t\t\t\t\"store\": \"true\",\r\n\t\t\t\t\t\"index\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"name\": {\r\n\t\t\t\t\t\"type\": \"text\",\r\n\t\t\t\t\t\"analyzer\": \"ik_max_word\",\r\n\t\t\t\t\t\"search_analyzer\": \"ik_smart\",\r\n\t\t\t\t\t\"store\": \"true\",\r\n\t\t\t\t\t\"index\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"content\": {\r\n\t\t\t\t\t\"type\": \"text\",\r\n\t\t\t\t\t\"analyzer\": \"ik_max_word\",\r\n\t\t\t\t\t\"search_analyzer\": \"ik_smart\",\r\n\t\t\t\t\t\"store\": \"true\",\r\n\t\t\t\t\t\"index\": true\r\n\t\t\t\t},\r\n\t\t\t\t\"createdate\": {\r\n\t\t\t\t\t\"type\": \"keyword\",\r\n\t\t\t\t\t\"store\": \"true\",\r\n\t\t\t\t\t\"index\": true\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t\"priority\": 10,\r\n\t\"version\": 10,\r\n\t\"_meta\": {\r\n\t\t\"description\": \"于吉利创建\",\r\n\t\t\"createtime\": \"2021-09-10\",\r\n\t\t\"function\": \"模板功能测试\"\r\n\t}\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/_index_template/test-1", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_index_template", "test-1" ] } }, "response": [] }, { "name": "查询文档", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/test-1/_search", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1", "_search" ] } }, "response": [] }, { "name": "多字段匹配查询", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"query\": {\r\n \"multi_match\": {\r\n \"query\": \"开发\",\r\n \"fields\": [\"name\",\"content\"]\r\n }\r\n }\r\n\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/test-1/_search", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1", "_search" ] } }, "response": [] }, { "name": "精准查询(短语搜索)", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"query\": {\r\n \"match_phrase\": {\r\n \"name\": \"开发\"\r\n }\r\n }\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http://192.168.8.202:9200/test-1/_search", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1", "_search" ] } }, "response": [] }, { "name": "查询文档_doc", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/test-1/_doc/_search", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1", "_doc", "_search" ] } }, "response": [] }, { "name": "查询文档 q=", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/test-1/_doc/_search?q=name:开发", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "test-1", "_doc", "_search" ], "query": [ { "key": "q", "value": "name:开发" } ] } }, "response": [] }, { "name": "查询所有文档", "request": { "method": "GET", "header": [], "url": { "raw": "http://192.168.8.202:9200/_search", "protocol": "http", "host": [ "192", "168", "8", "202" ], "port": "9200", "path": [ "_search" ] } }, "response": [] } ], "auth": { "type": "basic", "basic": [ { "key": "password", "value": "123456", "type": "string" }, { "key": "username", "value": "elastic", "type": "string" } ] }, "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }