From e6be0c753403d8574451558401eb184b30009cd2 Mon Sep 17 00:00:00 2001 From: silenceqi Date: Mon, 12 Apr 2021 21:38:05 +0800 Subject: [PATCH] add alias mock api --- web/mock/search/alias.js | 58 +++++++++++++++++++++++++++++++++++++ web/mock/search/template.js | 32 ++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 web/mock/search/alias.js diff --git a/web/mock/search/alias.js b/web/mock/search/alias.js new file mode 100644 index 00000000..6265e581 --- /dev/null +++ b/web/mock/search/alias.js @@ -0,0 +1,58 @@ +export default { + 'GET /elasticsearch/:id/alias': function (req, res) { + res.send({ + ".kibana": { + "alias": ".kibana", + "index": [ + ".kibana_1" + ] + }, + ".kibana-event-log-7.10.0": { + "alias": ".kibana-event-log-7.10.0", + "index": [ + ".kibana-event-log-7.10.0-000003", + ".kibana-event-log-7.10.0-000005", + ".kibana-event-log-7.10.0-000004", + ".kibana-event-log-7.10.0-000002" + ], + "write_index": ".kibana-event-log-7.10.0-000005" + }, + ".kibana_task_manager": { + "alias": ".kibana_task_manager", + "index": [ + ".kibana_task_manager_1" + ] + }, + "custom": { + "alias": "custom", + "index": [ + "test-custom" + ] + }, + "ilm-history-3": { + "alias": "ilm-history-3", + "index": [ + "ilm-history-3-000004", + "ilm-history-3-000005", + "ilm-history-3-000003", + "ilm-history-3-000002" + ], + "write_index": "ilm-history-3-000005" + }, + "metricbeat-7.10.0": { + "alias": "metricbeat-7.10.0", + "index": [ + "metricbeat-7.10.0-2021.04.07-000003", + "metricbeat-7.10.0-2021.02.03-000001", + "metricbeat-7.10.0-2021.03.06-000002" + ], + "write_index": "metricbeat-7.10.0-2021.04.07-000003" + } + }) + }, + 'POST /elasticsearch/:id/alias': function (req, res) { + res.send({ + "acknowledged": true + }) + } +} \ No newline at end of file diff --git a/web/mock/search/template.js b/web/mock/search/template.js index bae1ee12..b2171a9b 100644 --- a/web/mock/search/template.js +++ b/web/mock/search/template.js @@ -72,5 +72,37 @@ export default { "_id": "c1nc0dkagrh0jobkn6s0", "result": "deleted" }); + }, + 'GET /elasticsearch/:id/search_template_history/_search': function(req, res){ + res.send({ + "took": 0, + "timed_out": false, + "hits": { + "total": { + "relation": "eq", + "value": 1 + }, + "max_score": 0.5753642, + "hits": [ + { + "_index": ".infini-search-center_searchtemplatehistory", + "_type": "_doc", + "_id": "c1o5k3kagrh1tfml0qfg", + "_source": { + "action": "update", + "content": { + "cluster_id": "c0octmtath23m973pf4g", + "created": "2021-04-08T16:35:02.746223+08:00", + "name": "test_search_template", + "source": "{\"query\":{\"match\":{\"{{my_field}}\":\"{{my_value}}\"}},\"size\":\"{{my_size}}\"}", + "updated": "2021-04-08T22:03:25.987193+08:00" + }, + "created": "2021-04-09T21:43:42.611027+08:00", + "template_id": "c1nc0dkagrh0jobkn6s0" + } + } + ] + } + }); } }