modify mock

This commit is contained in:
silenceqi 2021-01-08 23:23:18 +08:00
parent e58c2412af
commit 7f8c3051e2
10 changed files with 934 additions and 636 deletions

View File

@ -13,8 +13,8 @@ import (
"infini.sh/search-center/model"
)
func (handler APIHandler) ReindexAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
reindexItem := &model.InfiniReindex{}
func (handler APIHandler) HandleReindexAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
reindexItem := &model.Reindex{}
id := ps.ByName("id")
if strings.Trim(id, "/") != "" {
reindexItem.ID = id
@ -42,7 +42,7 @@ func (handler APIHandler) ReindexAction(w http.ResponseWriter, req *http.Request
handler.WriteJSON(w, resResult, http.StatusOK)
}
func reindex(esName string, body *model.InfiniReindex) (string, error) {
func reindex(esName string, body *model.Reindex) (string, error) {
client := elastic.GetClient(esName)
source := map[string]interface{}{
"index": body.Source.Index,
@ -138,7 +138,7 @@ func (handler APIHandler) HandleGetRebuildListAction(w http.ResponseWriter, req
func SyncRebuildResult(esName string) error {
client := elastic.GetClient(esName)
esBody := `{"query":{"match":{"status": "RUNNING"}}}`
esBody := fmt.Sprintf(`{"query":{"match":{"status": "%s"}}}`, model.ReindexStatusRunning)
esRes, err := client.SearchWithRawQueryDSL("infinireindex", []byte(esBody))
if err != nil {
return err

View File

@ -26,7 +26,7 @@ func Init(cfg *config.AppConfig) {
ui.HandleUIMethod(api.PUT, pathPrefix+"doc/:index/:id", handler.HandleUpdateDocumentAction)
ui.HandleUIMethod(api.DELETE, pathPrefix+"doc/:index/:id", handler.HandleDeleteDocumentAction)
ui.HandleUIMethod(api.POST, pathPrefix+"rebuild/*id", handler.ReindexAction)
ui.HandleUIMethod(api.POST, pathPrefix+"rebuild/*id", handler.HandleReindexAction)
ui.HandleUIMethod(api.GET, pathPrefix+"rebuild/_search", handler.HandleGetRebuildListAction)
ui.HandleUIMethod(api.DELETE, pathPrefix+"rebuild/:id", handler.HandleDeleteRebuildAction)
ui.HandleUIMethod(api.GET, pathPrefix+"_cat/indices", handler.HandleGetIndicesAction)

View File

@ -70,7 +70,7 @@ func main() {
}, func() {
orm.RegisterSchema(model.Dict{})
orm.RegisterSchema(model.InfiniReindex{})
orm.RegisterSchema(model.Reindex{})
})
}

View File

@ -1,6 +0,0 @@
package model
type PageResult struct {
Total int `json:"total"`
Data interface{} `json:"data"`
}

View File

@ -16,7 +16,9 @@ const (
ReindexStatusFailed ReindexStatus = "FAILED"
)
type InfiniReindex struct {
//const IndexReindex = ".reindex"
type Reindex struct {
ID string `json:"id" elastic_meta:"_id"`
Name string `json:"name" elastic_mapping:"name:{type:text}"`
Desc string `json:"desc" elastic_mapping:"desc:{type:text}"`

View File

@ -1,160 +1,153 @@
export const queryData = {
"errmsg": "",
"errno": "0",
"payload": {
"data": [
{
"_index": "infini-test",
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "liugq@qq.com",
"hobbies": "[\"basketball\",\"pingpan\"]",
"id": "jc6_jXYBKoaaPbVfj_8W",
"name": "liugq国家"
"took": 0,
"timed_out": false,
"hits": {
"total": {
"relation": "eq",
"value": 11
},
{
"_index": "infini-test",
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": "[\"test5\"]",
"id": "bvhm18dath2d6oa9046g",
"name": "hello4"
},
{
"_index": "infini-test",
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": "[\"test2\"]",
"id": "bvhlv6dath2d6oa9045g",
"name": "test 词典"
},
{
"_index": "infini-test",
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": "[\"test1\"]",
"id": "bvhltpdath2d6oa90450",
"name": "liugqy"
},
{
"_index": "infini-test",
"address": "hunan zhuzhou",
"created_at": "2020-12-23T03:59:57.620Z",
"email": "cincky@qq.com",
"hobbies": "[\"basketball\",\"badminton1\"]",
"id": "js7EjXYBKoaaPbVfvf-c",
"name": "cincky"
},
{
"_index": "infini-test",
"address": "湖北武汉2",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": [
"test3"
],
"id": "bvi5ellath2e0ukbq5e0",
"name": "武汉test"
},
{
"_index": "infini-test",
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": [
"test3"
],
"id": "bvia41lath2eneoeeij0",
"name": "铁路测试词典"
},
{
"_index": "infini-test",
"address": "beijing",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": [
"basketball1",
"badminton"
],
"id": "bvia4ctath2eneoeeijg",
"name": "北京"
},
{
"_index": "infini-test",
"address": "湖北武汉",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": [
"test4"
],
"id": "bvi5omtath2e0ukbq5eg",
"name": "武汉2"
},
{
"_index": "infini-test",
"address": "hunan changsha1",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": [
"test3"
],
"id": "bvhm0d5ath2d6oa90460",
"name": "hello2"
}
],
"mappings": {
"infini-test": {
"mappings": {
"dynamic_templates": [
{
"strings": {
"mapping": {
"ignore_above": 256,
"type": "keyword"
},
"match_mapping_type": "string"
}
}
],
"properties": {
"address": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"age": {
"type": "integer"
},
"created_at": {
"type": "date"
},
"email": {
"type": "keyword"
},
"hobbies": {
"type": "text"
},
"id": {
"ignore_above": 256,
"type": "keyword"
},
"name": {
"type": "text"
}
"max_score": 1,
"hits": [
{
"_index": "infini-test",
"_type": "_doc",
"_id": "jc6_jXYBKoaaPbVfj_8W",
"_source": {
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "liugq@qq.com",
"hobbies": "[\"basketball\",\"pingpan\"]",
"id": "jc6_jXYBKoaaPbVfj_8W",
"name": "liugq国家"
}
},
{
"_index": "infini-test",
"_type": "_doc",
"_id": "bvhm18dath2d6oa9046g",
"_source": {
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": "[\"test5\"]",
"name": "hello4"
}
},
{
"_index": "infini-test",
"_type": "_doc",
"_id": "bvhlv6dath2d6oa9045g",
"_source": {
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": "[\"test2\"]",
"name": "test 词典"
}
},
{
"_index": "infini-test",
"_type": "_doc",
"_id": "bvhltpdath2d6oa90450",
"_source": {
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": "[\"test1\"]",
"name": "liugqy"
}
},
{
"_index": "infini-test",
"_type": "_doc",
"_id": "js7EjXYBKoaaPbVfvf-c",
"_source": {
"address": "hunan zhuzhou",
"created_at": "2020-12-23T03:59:57.620Z",
"email": "cincky@qq.com",
"hobbies": "[\"basketball\",\"badminton1\"]",
"id": "js7EjXYBKoaaPbVfvf-c",
"name": "cincky"
}
},
{
"_index": "infini-test",
"_type": "_doc",
"_id": "bvi5ellath2e0ukbq5e0",
"_source": {
"address": "湖北武汉2",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": [
"test3"
],
"id": "bvi5ellath2e0ukbq5e0",
"name": "武汉test"
}
},
{
"_index": "infini-test",
"_type": "_doc",
"_id": "bvia41lath2eneoeeij0",
"_source": {
"address": "hunan changsha",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": [
"test3"
],
"name": "铁路测试词典"
}
},
{
"_index": "infini-test",
"_type": "_doc",
"_id": "bvi5omtath2e0ukbq5eg",
"_source": {
"address": "湖北武汉",
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": [
"test4"
],
"id": "bvi5omtath2e0ukbq5eg",
"name": "武汉2"
}
},
{
"_index": "infini-test",
"_type": "_doc",
"_id": "bvhlsptath2d6oa9044g",
"_source": {
"address": "hunan changsha",
"created_at": "2020-12-29T08:24:49.715Z",
"email": "786027438@qq.com",
"hobbies": [
"test"
],
"id": "bvhlsptath2d6oa9044g",
"name": "hello"
}
},
{
"_index": "infini-test",
"_type": "_doc",
"_id": "bvhm0d5ath2d6oa90460",
"_source": {
"address": "hunan changsha1",
"age": 30,
"created_at": "2020-12-23T03:57:57.620Z",
"email": "786027438@qq.com",
"hobbies": [
"test3"
],
"id": "bvhm0d5ath2d6oa90460",
"name": "hello2"
}
}
}
},
"total": {
"relation": "eq",
"value": 11
]
}
}
}
},
"status": true
};

View File

@ -12,37 +12,29 @@ function getUUID(len){
}
export default {
// 'post /_search-center/doc/:index': function(req, res){
// switch(req.body.action){
// case 'SAVE':
// res.send({
// errno: "0",
// errmsg: ""
// });
// break;
// case 'ADD':
// res.send({
// errno: "0",
// errmsg: "",
// payload: {
// ...req.body.payload,
// id: getUUID(),
// }
// });
// break;
// case 'DELETE':
// res.send({
// errno: "0"
// });
// break;
// default:
// res.send(queryData)
// }
// },
// 'get /_search-center/indices/_cat': function(req, res){
// res.send({
// errno: "0",
// payload: ["infini-test"],
// });
// }
'get /_search-center/doc/:index/_search': function(req, res){
res.send(queryData)
},
'post /_search-center/doc/:index/_create': function(req, res){
res.send({
status: true,
payload: {
...req.body.payload,
id: getUUID(),
}
});
},
'put /_search-center/doc/:index/:id': function(req, res){
res.send({
status: true,
payload: req.body
});
},
'delete /_search-center/doc/:index/:id': function(req, res){
res.send({
status: true,
payload: null,
});
}
}

View File

@ -1,20 +1,238 @@
let data = {
"errmsg": "",
"errno": "0",
"payload": [
"blogs",
"mock_log1",
"metricbeat-7.10.0-2020.12.24-000002",
"metricbeat-7.10.0-2020.11.24-000001",
"infinireindex",
"gateway_requests",
"infini-test1",
"dict",
"infini-test",
"mock_log",
"infini-test8",
"infini-dict"
]
{
"health": "green",
"index": "blogs",
"uuid": "3YOmOx_BSDqF-6EqAzBLVg",
"pri": "1",
"rep": "1",
"docs.count": "3",
"docs.deleted": "0",
"store.size": "29.2kb",
"pri.store.size": "14.6kb"
},
{
"health": "green",
"index": ".apm-agent-configuration",
"uuid": "uQiIf-y9TuaOaO1H0stK0g",
"pri": "1",
"rep": "1",
"docs.count": "0",
"docs.deleted": "0",
"store.size": "416b",
"pri.store.size": "208b"
},
{
"health": "green",
"index": ".kibana_2",
"uuid": "YI3glc42SOugYrw07g4ANw",
"pri": "1",
"rep": "1",
"docs.count": "0",
"docs.deleted": "0",
"store.size": "416b",
"pri.store.size": "208b"
},
{
"health": "green",
"index": ".kibana_1",
"uuid": "EK13_lDIRN-vSTd0WRFPgg",
"pri": "1",
"rep": "1",
"docs.count": "158",
"docs.deleted": "38",
"store.size": "20.9mb",
"pri.store.size": "10.4mb"
},
{
"health": "green",
"index": ".tasks",
"uuid": "F2IVDbwASJOGgSbhvs6rpQ",
"pri": "1",
"rep": "1",
"docs.count": "48",
"docs.deleted": "0",
"store.size": "148.2kb",
"pri.store.size": "74.1kb"
},
{
"health": "green",
"index": "mock_log1",
"uuid": "FEuAjVAYTCG5FJSVqjB4cA",
"pri": "1",
"rep": "1",
"docs.count": "45806",
"docs.deleted": "0",
"store.size": "4.1mb",
"pri.store.size": "2mb"
},
{
"health": "green",
"index": "metricbeat-7.10.0-2020.12.24-000002",
"uuid": "Q3f7CTSfScCLTUCBKURzCw",
"pri": "1",
"rep": "1",
"docs.count": "0",
"docs.deleted": "0",
"store.size": "416b",
"pri.store.size": "208b"
},
{
"health": "green",
"index": "metricbeat-7.10.0-2020.11.24-000001",
"uuid": "j5hJlvknQliWmVvdLVSH7w",
"pri": "1",
"rep": "1",
"docs.count": "257315",
"docs.deleted": "0",
"store.size": "144.6mb",
"pri.store.size": "72.3mb"
},
{
"health": "green",
"index": "infinireindex",
"uuid": "lKLfKdswTqOjYmQrQehnQw",
"pri": "1",
"rep": "1",
"docs.count": "7",
"docs.deleted": "2",
"store.size": "285kb",
"pri.store.size": "127.5kb"
},
{
"health": "green",
"index": ".apm-custom-link",
"uuid": "3jcumkqTRJi7PhsLLSwklw",
"pri": "1",
"rep": "1",
"docs.count": "0",
"docs.deleted": "0",
"store.size": "416b",
"pri.store.size": "208b"
},
{
"health": "green",
"index": "gateway_requests",
"uuid": "C0j0942KR6muJMHyagG2AQ",
"pri": "1",
"rep": "1",
"docs.count": "17961",
"docs.deleted": "0",
"store.size": "109.9mb",
"pri.store.size": "54.9mb"
},
{
"health": "yellow",
"index": ".kibana_task_manager_1",
"uuid": "uiVESvY_TiedZ5LuQLWxuw",
"pri": "1",
"rep": "1",
"docs.count": "5",
"docs.deleted": "10455",
"store.size": "2.6mb",
"pri.store.size": "2.6mb"
},
{
"health": "green",
"index": "infini-test1",
"uuid": "mVxvSFwSRBmxQx8tvIf7Jw",
"pri": "1",
"rep": "1",
"docs.count": "5",
"docs.deleted": "2",
"store.size": "48.1kb",
"pri.store.size": "29.3kb"
},
{
"health": "green",
"index": "dict",
"uuid": "F6vp1k_XRn-FmXoHOsBl2Q",
"pri": "1",
"rep": "1",
"docs.count": "8",
"docs.deleted": "1",
"store.size": "301.4kb",
"pri.store.size": "149.4kb"
},
{
"health": "green",
"index": ".kibana-event-log-7.10.0-000001",
"uuid": "ZhsJvWMeT9S0BzRhHzVr6Q",
"pri": "1",
"rep": "1",
"docs.count": "16",
"docs.deleted": "0",
"store.size": "79.9kb",
"pri.store.size": "39.9kb"
},
{
"health": "green",
"index": "infini-test",
"uuid": "eFLziuhBQ02ErA0n58-2hg",
"pri": "1",
"rep": "1",
"docs.count": "11",
"docs.deleted": "4",
"store.size": "86.3kb",
"pri.store.size": "43.1kb"
},
{
"health": "green",
"index": "mock_log",
"uuid": "NI7ntH_YRHapvjqB30LFQA",
"pri": "1",
"rep": "1",
"docs.count": "45806",
"docs.deleted": "0",
"store.size": "4.1mb",
"pri.store.size": "2mb"
},
{
"health": "green",
"index": ".async-search",
"uuid": "1ygzjQtgQDyksA7CDAeZxw",
"pri": "1",
"rep": "1",
"docs.count": "0",
"docs.deleted": "0",
"store.size": "462b",
"pri.store.size": "231b"
},
{
"health": "green",
"index": "infini-test8",
"uuid": "Uwj8JfmIRrOWQs1KT-pn9A",
"pri": "1",
"rep": "1",
"docs.count": "16",
"docs.deleted": "4",
"store.size": "35.4kb",
"pri.store.size": "17.7kb"
},
{
"health": "green",
"index": ".kibana-event-log-7.10.0-000002",
"uuid": "DyUerTJJR5Cy1HslL5qN8w",
"pri": "1",
"rep": "1",
"docs.count": "1",
"docs.deleted": "0",
"store.size": "11.2kb",
"pri.store.size": "5.6kb"
},
{
"health": "green",
"index": "infini-dict",
"uuid": "606XUzqLQFOna39joQFhlQ",
"pri": "1",
"rep": "1",
"docs.count": "8",
"docs.deleted": "1",
"store.size": "264.8kb",
"pri.store.size": "132.4kb"
}
],
"status": true
};
const mappings = {
@ -45875,10 +46093,10 @@ const mappings = {
};
export default {
// 'get /_search-center/indices/_cat': function(req, res){
// res.send(data)
// },
// 'get /_search-center/indices/_mappings/:index': function(req, res){
// res.send(mappings)
// }
'get /_search-center/_cat/indices': function(req, res){
res.send(data)
},
'get /_search-center/index/:index/_mappings': function(req, res){
res.send(mappings)
}
}

View File

@ -1,432 +1,533 @@
let data = {
"errmsg": "",
"errno": "0",
"payload": {
"data": [
{
"_index": "infinireindex",
"created_at": "2021-01-06T15:55:31.426604+08:00",
"desc": "test source index not exists",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"id": "bvqmpstath24tgfo107g",
"name": "test failed",
"source": {
"_source": [],
"index": "infini-testx",
"query": null
},
"status": "FAILED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:824925",
"task_source": {
"completed": true,
"error": {
"index": "infini-testx",
"index_uuid": "_na_",
"reason": "no such index [infini-testx]",
"resource.id": "infini-testx",
"resource.type": "index_or_alias",
"type": "index_not_found_exception"
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-testx] to [infini-test8][_doc]",
"headers": {},
"id": 824925,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 172714,
"start_time_in_millis": 1609919731425,
"status": {
"batches": 0,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 0,
"updated": 0,
"version_conflicts": 0
},
"type": "transport"
}
}
"took": 0,
"timed_out": false,
"hits": {
"total": {
"relation": "eq",
"value": 7
},
{
"_index": "infinireindex",
"created_at": "2021-01-06T15:48:46.585112+08:00",
"desc": "test query param again",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"id": "bvqmmnlath24tgfo1070",
"name": "test query one",
"source": {
"_source": [],
"index": "infini-test",
"query": {
"match": {
"name": "cincky"
"max_score": 0,
"hits": [
{
"_index": "infinireindex",
"_type": "_doc",
"_id": "bvrdoldath27go6rq64g",
"_source": {
"created_at": "2021-01-07T18:03:01.769901+08:00",
"desc": "",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"id": "bvrdoldath27go6rq64g",
"name": "test ddd",
"source": {
"_source": [],
"index": "infini-test",
"query": null
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:1050387",
"task_source": {
"completed": true,
"response": {
"batches": 1,
"created": 0,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 79,
"total": 11,
"updated": 11,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test] to [infini-test8][_doc]",
"headers": {},
"id": 1050387,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 79494026,
"start_time_in_millis": 1610013781769,
"status": {
"batches": 1,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 11,
"updated": 11,
"version_conflicts": 0
},
"type": "transport"
}
}
}
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:822567",
"task_source": {
"completed": true,
"response": {
"batches": 1,
"created": 0,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
{
"_index": "infinireindex",
"_type": "_doc",
"_id": "bvqmpstath24tgfo107g",
"_source": {
"created_at": "2021-01-06T15:55:31.426604+08:00",
"desc": "test source index not exists",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 44,
"total": 1,
"updated": 1,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test] to [infini-test8][_doc]",
"headers": {},
"id": 822567,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 44277146,
"start_time_in_millis": 1609919326584,
"status": {
"batches": 1,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
"id": "bvqmpstath24tgfo107g",
"name": "test failed",
"source": {
"_source": [],
"index": "infini-testx",
"query": null
},
"status": "FAILED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:824925",
"task_source": {
"completed": true,
"error": {
"index": "infini-testx",
"index_uuid": "_na_",
"reason": "no such index [infini-testx]",
"resource.id": "infini-testx",
"resource.type": "index_or_alias",
"type": "index_not_found_exception"
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 1,
"updated": 1,
"version_conflicts": 0
},
"type": "transport"
}
}
},
{
"_index": "infinireindex",
"created_at": "2021-01-06T15:46:04.745132+08:00",
"desc": "test query param",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"id": "bvqmlf5ath24tgfo106g",
"name": "test query",
"source": {
"_source": [],
"index": "infini-test1",
"query": {
"match": {
"name": "test"
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-testx] to [infini-test8][_doc]",
"headers": {},
"id": 824925,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 172714,
"start_time_in_millis": 1609919731425,
"status": {
"batches": 0,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 0,
"updated": 0,
"version_conflicts": 0
},
"type": "transport"
}
}
}
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:821548",
"task_source": {
"completed": true,
"response": {
"batches": 0,
"created": 0,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
{
"_index": "infinireindex",
"_type": "_doc",
"_id": "bvqmmnlath24tgfo1070",
"_source": {
"created_at": "2021-01-06T15:48:46.585112+08:00",
"desc": "test query param again",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 0,
"total": 0,
"updated": 0,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test1] to [infini-test8][_doc]",
"headers": {},
"id": 821548,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 982379,
"start_time_in_millis": 1609919164744,
"status": {
"batches": 0,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
"id": "bvqmmnlath24tgfo1070",
"name": "test query one",
"source": {
"_source": [],
"index": "infini-test",
"query": {
"match": {
"name": "cincky"
}
}
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:822567",
"task_source": {
"completed": true,
"response": {
"batches": 1,
"created": 0,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 44,
"total": 1,
"updated": 1,
"version_conflicts": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 0,
"updated": 0,
"version_conflicts": 0
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test] to [infini-test8][_doc]",
"headers": {},
"id": 822567,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 44277146,
"start_time_in_millis": 1609919326584,
"status": {
"batches": 1,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 1,
"updated": 1,
"version_conflicts": 0
},
"type": "transport"
}
}
}
},
{
"_index": "infinireindex",
"_type": "_doc",
"_id": "bvqmlf5ath24tgfo106g",
"_source": {
"created_at": "2021-01-06T15:46:04.745132+08:00",
"desc": "test query param",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"type": "transport"
"id": "bvqmlf5ath24tgfo106g",
"name": "test query",
"source": {
"_source": [],
"index": "infini-test1",
"query": {
"match": {
"name": "test"
}
}
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:821548",
"task_source": {
"completed": true,
"response": {
"batches": 0,
"created": 0,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 0,
"total": 0,
"updated": 0,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test1] to [infini-test8][_doc]",
"headers": {},
"id": 821548,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 982379,
"start_time_in_millis": 1609919164744,
"status": {
"batches": 0,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 0,
"updated": 0,
"version_conflicts": 0
},
"type": "transport"
}
}
}
},
{
"_index": "infinireindex",
"_type": "_doc",
"_id": "bvqmkilath24tgfo1060",
"_source": {
"created_at": "2021-01-06T15:44:10.535851+08:00",
"desc": "test source param",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"id": "bvqmkilath24tgfo1060",
"name": "test source",
"source": {
"_source": [
"email",
"hobbies",
"created_at",
"name"
],
"index": "infini-test1",
"query": null
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:820833",
"task_source": {
"completed": true,
"response": {
"batches": 1,
"created": 0,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 53,
"total": 4,
"updated": 4,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test1] to [infini-test8][_doc]",
"headers": {},
"id": 820833,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 53101238,
"start_time_in_millis": 1609919050535,
"status": {
"batches": 1,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 4,
"updated": 4,
"version_conflicts": 0
},
"type": "transport"
}
}
}
},
{
"_index": "infinireindex",
"_type": "_doc",
"_id": "bvqmj55ath24tgfo105g",
"_source": {
"created_at": "2021-01-06T15:41:08.159721+08:00",
"desc": "test pipeline param",
"dest": {
"index": "infini-test8",
"pipeline": "test"
},
"id": "bvqmj55ath24tgfo105g",
"name": "test pipeline",
"source": {
"_source": [],
"index": "infini-test1",
"query": null
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:819744",
"task_source": {
"completed": true,
"response": {
"batches": 1,
"created": 0,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 251,
"total": 4,
"updated": 4,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test1] to [infini-test8][_doc]",
"headers": {},
"id": 819744,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 251872120,
"start_time_in_millis": 1609918868159,
"status": {
"batches": 1,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 4,
"updated": 4,
"version_conflicts": 0
},
"type": "transport"
}
}
}
},
{
"_index": "infinireindex",
"_type": "_doc",
"_id": "bvq89p5ath243f63hngg",
"_source": {
"created_at": "2021-01-05T23:25:24.751473+08:00",
"desc": "test new rebuild api",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"id": "bvq89p5ath243f63hngg",
"name": "test new rebuild api",
"source": {
"_source": [],
"index": "infini-test",
"query": null
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:707730",
"task_source": {
"completed": true,
"response": {
"batches": 1,
"created": 11,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 117,
"total": 11,
"updated": 0,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test] to [infini-test8][_doc]",
"headers": {},
"id": 707730,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 118081190,
"start_time_in_millis": 1609860324750,
"status": {
"batches": 1,
"created": 11,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 11,
"updated": 0,
"version_conflicts": 0
},
"type": "transport"
}
}
}
}
},
{
"_index": "infinireindex",
"created_at": "2021-01-06T15:44:10.535851+08:00",
"desc": "test source param",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"id": "bvqmkilath24tgfo1060",
"name": "test source",
"source": {
"_source": [
"email",
"hobbies",
"created_at",
"name"
],
"index": "infini-test1",
"query": null
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:820833",
"task_source": {
"completed": true,
"response": {
"batches": 1,
"created": 0,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 53,
"total": 4,
"updated": 4,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test1] to [infini-test8][_doc]",
"headers": {},
"id": 820833,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 53101238,
"start_time_in_millis": 1609919050535,
"status": {
"batches": 1,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 4,
"updated": 4,
"version_conflicts": 0
},
"type": "transport"
}
}
},
{
"_index": "infinireindex",
"created_at": "2021-01-06T15:41:08.159721+08:00",
"desc": "test pipeline param",
"dest": {
"index": "infini-test8",
"pipeline": "test"
},
"id": "bvqmj55ath24tgfo105g",
"name": "test pipeline",
"source": {
"_source": [],
"index": "infini-test1",
"query": null
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:819744",
"task_source": {
"completed": true,
"response": {
"batches": 1,
"created": 0,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 251,
"total": 4,
"updated": 4,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test1] to [infini-test8][_doc]",
"headers": {},
"id": 819744,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 251872120,
"start_time_in_millis": 1609918868159,
"status": {
"batches": 1,
"created": 0,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 4,
"updated": 4,
"version_conflicts": 0
},
"type": "transport"
}
}
},
{
"_index": "infinireindex",
"created_at": "2021-01-05T23:25:24.751473+08:00",
"desc": "test new rebuild api",
"dest": {
"index": "infini-test8",
"pipeline": ""
},
"id": "bvq89p5ath243f63hngg",
"name": "test new rebuild api",
"source": {
"_source": [],
"index": "infini-test",
"query": null
},
"status": "SUCCEED",
"task_id": "F0D6OfeVSzuMhf5528ANTw:707730",
"task_source": {
"completed": true,
"response": {
"batches": 1,
"created": 11,
"deleted": 0,
"failures": [],
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"throttled_until": "0s",
"throttled_until_millis": 0,
"timed_out": false,
"took": 117,
"total": 11,
"updated": 0,
"version_conflicts": 0
},
"task": {
"action": "indices:data/write/reindex",
"cancellable": true,
"description": "reindex from [infini-test] to [infini-test8][_doc]",
"headers": {},
"id": 707730,
"node": "F0D6OfeVSzuMhf5528ANTw",
"running_time_in_nanos": 118081190,
"start_time_in_millis": 1609860324750,
"status": {
"batches": 1,
"created": 11,
"deleted": 0,
"noops": 0,
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"throttled_until_millis": 0,
"total": 11,
"updated": 0,
"version_conflicts": 0
},
"type": "transport"
}
}
}
],
"total": {
"relation": "eq",
"value": 6
]
}
}
},
"status": true
};
export default {
// 'get /_search-center/rebuild/list': function(req, res){
// res.send(data)
// }
'get /_search-center/rebuild/_search': function(req, res){
res.send(data)
}
}

View File

@ -4,10 +4,7 @@ import {pathPrefix} from './common';
export async function getDocList(params) {
return request(`${pathPrefix}/doc/${params.index}/_search`, {
method: 'POST',
body: {
action: 'SEARCH',
...params,
},
body: params,
});
}
@ -21,6 +18,7 @@ export async function saveDoc(params) {
export async function deleteDoc(params) {
return request(`${pathPrefix}/doc/${params.index}/${params.data.id}`, {
method: 'DELETE',
body: ['testid1', 'testid2'],
});
}