Created
February 3, 2021 15:15
-
-
Save ebuildy/7b91413db3b83e89823335d513e93a6b to your computer and use it in GitHub Desktop.
Configure elasticsearch via newman
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "info": { | |
| "name": "Configure elasticsearch", | |
| "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" | |
| }, | |
| "item": [ | |
| { | |
| "id": "livecycle-delete", | |
| "name": "Remove existing livecycle", | |
| "request": { | |
| "method": "DELETE", | |
| "url": "http://datahub-hot-es-client:9200/_ilm/policy/events" | |
| } | |
| }, | |
| { | |
| "id": "livecycle-create", | |
| "name": "Index livecycle policy", | |
| "request": { | |
| "method": "PUT", | |
| "url": "http://datahub-hot-es-client:9200/_ilm/policy/events", | |
| "header": "Content-Type: application/json", | |
| "body": { | |
| "mode": "raw", | |
| "raw": "{\"policy\": {\"phases\": {\"hot\": {\"min_age\": \"0ms\", \"actions\": {}}, \"warm\": {\"min_age\": \"1d\", \"actions\": {\"forcemerge\": {\"max_num_segments\": 1}, \"migrate\": {\"enabled\": false}, \"shrink\": {\"number_of_shards\": 1}}}, \"delete\": {\"min_age\": \"7d\", \"actions\": {}}}}}" | |
| } | |
| }, | |
| "event": [ | |
| { | |
| "listen": "test", | |
| "script": { | |
| "type": "text/javascript", | |
| "exec": [ | |
| "pm.test('expect response be 200', function () {", | |
| " pm.response.to.be.ok", | |
| "})" | |
| ] | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "id": "template-delete", | |
| "name": "Remove existing index template", | |
| "request": { | |
| "method": "DELETE", | |
| "url": "http://datahub-hot-es-client:9200/_index_template/events" | |
| } | |
| }, | |
| { | |
| "id": "template-create", | |
| "name": "Index template", | |
| "request": { | |
| "method": "PUT", | |
| "url": "http://datahub-hot-es-client:9200/_index_template/events", | |
| "header": "Content-Type: application/json", | |
| "body": { | |
| "mode": "raw", | |
| "raw": "{\"template\": {\"settings\": {\"index\": {\"lifecycle\": {\"name\": \"events\"}, \"similarity\": {\"default\": {\"type\": \"boolean\"}}, \"number_of_shards\": 3, \"number_of_replicas\": 1, \"refresh_interval\": \"10s\", \"analysis\": {\"filter\": {\"my_stop_fr\": {\"type\": \"stop\", \"stopwords\": \"_french_\"}, \"my_stop_en\": {\"type\": \"stop\", \"stopwords\": \"_english_\"}}, \"analyzer\": {\"my_keyword\": {\"filter\": [\"lowercase\", \"asciifolding\"], \"type\": \"custom\", \"tokenizer\": \"keyword\"}, \"my_simple\": {\"filter\": [\"lowercase\", \"asciifolding\"], \"tokenizer\": \"standard\"}, \"path\": {\"filter\": [\"lowercase\"], \"type\": \"custom\", \"tokenizer\": \"path_hierarchy\"}, \"query_words\": {\"filter\": [\"lowercase\", \"asciifolding\", \"my_stop_fr\", \"my_stop_en\"], \"type\": \"custom\", \"tokenizer\": \"standard\"}}}}}, \"mappings\": {\"_source\": {\"enabled\": true, \"includes\": [], \"excludes\": []}, \"_routing\": {\"required\": false}, \"dynamic\": true, \"numeric_detection\": false, \"date_detection\": true, \"dynamic_date_formats\": [\"strict_date_optional_time\", \"yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z\"], \"dynamic_templates\": [{\"string_query\": {\"mapping\": {\"type\": \"keyword\", \"norms\": false, \"fields\": {\"words\": {\"norms\": false, \"analyzer\": \"query_words\", \"type\": \"text\"}, \"keyword\": {\"analyzer\": \"my_keyword\", \"type\": \"text\"}}}, \"match\": \"query\", \"match_mapping_type\": \"string\"}}, {\"string_query_q\": {\"mapping\": {\"type\": \"keyword\", \"norms\": false, \"fields\": {\"keyword\": {\"analyzer\": \"my_keyword\", \"norms\": false, \"type\": \"text\"}}}, \"match\": \"q\", \"match_mapping_type\": \"string\"}}, {\"string_user_agent\": {\"mapping\": {\"type\": \"keyword\", \"norms\": false, \"fields\": {\"keyword\": {\"norms\": false, \"analyzer\": \"my_keyword\", \"type\": \"text\"}}}, \"match\": \"user_agent\", \"match_mapping_type\": \"string\"}}, {\"data_message\": {\"mapping\": {\"type\": \"keyword\", \"norms\": false, \"fields\": {\"keyword\": {\"analyzer\": \"my_keyword\", \"norms\": false, \"type\": \"text\"}}}, \"match\": \"message\", \"match_mapping_type\": \"string\"}}, {\"url\": {\"mapping\": {\"type\": \"keyword\", \"norms\": false, \"fields\": {\"keyword\": {\"analyzer\": \"my_keyword\", \"norms\": false, \"type\": \"text\"}}}, \"match\": \"url\", \"match_mapping_type\": \"string\"}}, {\"all_path\": {\"mapping\": {\"type\": \"keyword\", \"norms\": false, \"fields\": {\"path\": {\"analyzer\": \"path\", \"norms\": false, \"type\": \"text\"}}}, \"match\": \"*_path\", \"match_mapping_type\": \"string\"}}, {\"all_string\": {\"mapping\": {\"norms\": false, \"type\": \"keyword\"}, \"match\": \"*\", \"match_mapping_type\": \"string\"}}, {\"all_numeric\": {\"mapping\": {\"type\": \"integer\"}, \"match_mapping_type\": \"long\", \"unmatch\": \"*_long\"}}]}, \"aliases\": {\"events\": {}}}, \"index_patterns\": [\"events-*\"]}" | |
| } | |
| }, | |
| "event": [ | |
| { | |
| "listen": "test", | |
| "script": { | |
| "type": "text/javascript", | |
| "exec": [ | |
| "pm.test('expect response be 200', function () {", | |
| " pm.response.to.be.ok", | |
| "})" | |
| ] | |
| } | |
| } | |
| ] | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment