Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dendihandian/a894735a2beceba17860e66007693352 to your computer and use it in GitHub Desktop.
Save dendihandian/a894735a2beceba17860e66007693352 to your computer and use it in GitHub Desktop.
Elasticsearch requests examples documented as postman collection. Here the env used as well https://gist.github.com/dendihandian/5d91d0ee22fead4fadc2cca482c05904
{
"info": {
"_postman_id": "467b0172-d345-4e3b-9bbb-edc7076ae771",
"name": "Elasticsearch Examples",
"description": "Elasticsearch Version: 6.3\n\nHow to install elasticsearch: https://blog.drizzersilverberg.com/2018/06/06/memulai-elasticsearch/\n",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Shop",
"description": "",
"item": [
{
"name": "Create Index",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"settings\" : {\n \"index\" : {\n \"number_of_shards\" : 3, \n \"number_of_replicas\" : 2 \n }\n }\n}"
},
"url": {
"raw": "{{elasticsearch_server}}/shop",
"host": [
"{{elasticsearch_server}}"
],
"path": [
"shop"
]
}
},
"response": []
},
{
"name": "Create Index (Simplified)",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"settings\" : {\n \"number_of_shards\" : 3,\n \"number_of_replicas\" : 2\n }\n}"
},
"url": {
"raw": "{{elasticsearch_server}}/shop",
"host": [
"{{elasticsearch_server}}"
],
"path": [
"shop"
]
}
},
"response": []
},
{
"name": "Create Index & Mappings",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"settings\" : {\n \"number_of_shards\" : 1\n },\n \"mappings\" : {\n \"product\" : {\n \"properties\" : {\n \"id\" : { \"type\" : \"integer\" },\n \"name\" : { \"type\" : \"text\" },\n \"slug\" : { \"type\" : \"text\" },\n \"stock\" : { \"type\" : \"integer\" },\n \"price\" : { \"type\" : \"integer\" },\n \"description\" : { \"type\" : \"text\" }\n }\n }\n }\n}"
},
"url": {
"raw": "{{elasticsearch_server}}/shop",
"host": [
"{{elasticsearch_server}}"
],
"path": [
"shop"
]
}
},
"response": []
}
]
},
{
"name": "_cat",
"description": "",
"item": [
{
"name": "Indices",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {},
"url": {
"raw": "{{elasticsearch_server}}/_cat/indices?v",
"host": [
"{{elasticsearch_server}}"
],
"path": [
"_cat",
"indices"
],
"query": [
{
"key": "v",
"value": null
}
]
}
},
"response": []
},
{
"name": "Health",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {},
"url": {
"raw": "{{elasticsearch_server}}/_cat/health?v",
"host": [
"{{elasticsearch_server}}"
],
"path": [
"_cat",
"health"
],
"query": [
{
"key": "v",
"value": null
}
]
}
},
"response": []
},
{
"name": "Nodes",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {},
"url": {
"raw": "{{elasticsearch_server}}/_cat/nodes?v",
"host": [
"{{elasticsearch_server}}"
],
"path": [
"_cat",
"nodes"
],
"query": [
{
"key": "v",
"value": null
}
]
}
},
"response": []
}
]
},
{
"name": "Elasticsearch Info",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {},
"url": {
"raw": "{{elasticsearch_server}}",
"host": [
"{{elasticsearch_server}}"
]
},
"description": "show the elasticsearch version, cluster name, etc."
},
"response": []
},
{
"name": "Flush All",
"request": {
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {},
"url": {
"raw": "{{elasticsearch_server}}/_all",
"host": [
"{{elasticsearch_server}}"
],
"path": [
"_all"
]
},
"description": "WARNING: This will delete all cluster, index, and all data."
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "d235d1d4-f8f9-44b5-bbc3-e6255287fad1",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "bbbf702d-8e12-4828-85fd-b13afc7c04d6",
"type": "text/javascript",
"exec": [
""
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment