add proxy mock api
This commit is contained in:
parent
71a9e6bc24
commit
242cd31189
|
@ -1,5 +1,5 @@
|
||||||
export default {
|
export default {
|
||||||
// 'POST /elasticsearch/:id/_proxy': function(req, res){
|
// 'POST /elasticsearch/:id/_console/proxy': function(req, res){
|
||||||
// res.set('content-type', 'content-type: text/plain; charset=UTF-8');
|
// res.set('content-type', 'content-type: text/plain; charset=UTF-8');
|
||||||
// res.send('.security .security-7 - - - -\n' +
|
// res.send('.security .security-7 - - - -\n' +
|
||||||
// 'ilm-history-2 ilm-history-2-000002 - - - true\n' +
|
// 'ilm-history-2 ilm-history-2-000002 - - - true\n' +
|
||||||
|
@ -54,4 +54,163 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//查看 proxy 请求历史记录
|
||||||
|
'GET /elasticsearch/:id/proxy_history/_search': function(req, res){
|
||||||
|
res.send({
|
||||||
|
"took" : 1055,
|
||||||
|
"timed_out" : false,
|
||||||
|
"_shards" : {
|
||||||
|
"total" : 37,
|
||||||
|
"successful" : 37,
|
||||||
|
"skipped" : 0,
|
||||||
|
"failed" : 0
|
||||||
|
},
|
||||||
|
"hits" : {
|
||||||
|
"total" : {
|
||||||
|
"value" : 10000,
|
||||||
|
"relation" : "gte"
|
||||||
|
},
|
||||||
|
"max_score" : 1.0,
|
||||||
|
"hits" : [
|
||||||
|
{
|
||||||
|
"_index" : "gateway-command-history-7.9.2-000001",
|
||||||
|
"_type" : "_doc",
|
||||||
|
"_id" : "VLvqYncBwyX1iJ4H4cBA",
|
||||||
|
"_score" : 1.0,
|
||||||
|
"_source" : {
|
||||||
|
"created" : "2021-02-02T13:23:16.799Z",
|
||||||
|
"request" : {
|
||||||
|
"method" : "POST",
|
||||||
|
"path" : "/myindex/_search",
|
||||||
|
"body" : "{ \"query\": { \"match\": { \"name\": \"medcl\" } } }"
|
||||||
|
},
|
||||||
|
"status":200,
|
||||||
|
"user":{
|
||||||
|
"username":"medcl",
|
||||||
|
"group":["superuser"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
//保存/修改常用命令, id 可选
|
||||||
|
//curl -XPOST /elasticsearch/:id/command/:id -d'
|
||||||
|
// {
|
||||||
|
// "request" : {
|
||||||
|
// "method" : "POST",
|
||||||
|
// "path" : "/myindex/_search",
|
||||||
|
// "body" : "{ \"query\": { \"match\": { \"name\": \"medcl\" } } }"
|
||||||
|
// },
|
||||||
|
// "status":200,
|
||||||
|
// "title":"一个常用查询的例子",
|
||||||
|
// "tag":["example","search"],
|
||||||
|
// "user":{
|
||||||
|
// "username":"medcl",
|
||||||
|
// "group":["superuser"]
|
||||||
|
// }
|
||||||
|
// }'
|
||||||
|
'POST /elasticsearch/:id/command/[:id]': function(req, res){
|
||||||
|
res.send({
|
||||||
|
"_id": "c0oc4kkgq9s8qss2uk50",
|
||||||
|
"_source": {
|
||||||
|
"created" : "2021-02-02T13:23:16.799Z",
|
||||||
|
"request" : {
|
||||||
|
"method" : "POST",
|
||||||
|
"path" : "/myindex/_search",
|
||||||
|
"body" : "{ \"query\": { \"match\": { \"name\": \"medcl\" } } }"
|
||||||
|
},
|
||||||
|
"status":200,
|
||||||
|
"title":"一个常用查询的例子",
|
||||||
|
"tag":["example","search"],
|
||||||
|
"user":{
|
||||||
|
"username":"medcl",
|
||||||
|
"group":["superuser"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": "created"
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
//加载常用命令
|
||||||
|
'GET /elasticsearch/:id/command/:id': function(req, res){
|
||||||
|
res.send({
|
||||||
|
"_id": "c0oc4kkgq9s8qss2uk50",
|
||||||
|
"_source": {
|
||||||
|
"created" : "2021-02-02T13:23:16.799Z",
|
||||||
|
"request" : {
|
||||||
|
"method" : "POST",
|
||||||
|
"path" : "/myindex/_search",
|
||||||
|
"body" : "{ \"query\": { \"match\": { \"name\": \"medcl\" } } }"
|
||||||
|
},
|
||||||
|
"status":200,
|
||||||
|
"title":"一个常用查询的例子",
|
||||||
|
"tag":["example","search"],
|
||||||
|
"user":{
|
||||||
|
"username":"medcl",
|
||||||
|
"group":["superuser"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"found": true
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
//删除常用命令
|
||||||
|
'DELETE /elasticsearch/:id/command/:command_id': function(req, res){
|
||||||
|
res.send({
|
||||||
|
"_id": "c0oc4kkgq9s8qss2uk50",
|
||||||
|
"result": "deleted"
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
//搜索常用命令
|
||||||
|
'GET /elasticsearch/:id/command/_search': function(req, res){
|
||||||
|
res.send({
|
||||||
|
"took" : 1055,
|
||||||
|
"timed_out" : false,
|
||||||
|
"_shards" : {
|
||||||
|
"total" : 37,
|
||||||
|
"successful" : 37,
|
||||||
|
"skipped" : 0,
|
||||||
|
"failed" : 0
|
||||||
|
},
|
||||||
|
"hits" : {
|
||||||
|
"total" : {
|
||||||
|
"value" : 10000,
|
||||||
|
"relation" : "gte"
|
||||||
|
},
|
||||||
|
"max_score" : 1.0,
|
||||||
|
"hits" : [
|
||||||
|
{
|
||||||
|
"_index" : "gateway-command-7.9.2-000001",
|
||||||
|
"_type" : "_doc",
|
||||||
|
"_id" : "VLvqYncBwyX1iJ4H4cBA",
|
||||||
|
"_score" : 1.0,
|
||||||
|
"_source" : {
|
||||||
|
"created" : "2021-02-02T13:23:16.799Z",
|
||||||
|
"request" : {
|
||||||
|
"method" : "POST",
|
||||||
|
"path" : "/myindex/_search",
|
||||||
|
"body" : "{ \"query\": { \"match\": { \"name\": \"medcl\" } } }"
|
||||||
|
},
|
||||||
|
"status":200,
|
||||||
|
"title":"一个常用查询的例子",
|
||||||
|
"tag":["example","search"],
|
||||||
|
"user":{
|
||||||
|
"username":"medcl",
|
||||||
|
"group":["superuser"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue