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" "infini.sh/search-center/model"
) )
func (handler APIHandler) ReindexAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) { func (handler APIHandler) HandleReindexAction(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
reindexItem := &model.InfiniReindex{} reindexItem := &model.Reindex{}
id := ps.ByName("id") id := ps.ByName("id")
if strings.Trim(id, "/") != "" { if strings.Trim(id, "/") != "" {
reindexItem.ID = id reindexItem.ID = id
@ -42,7 +42,7 @@ func (handler APIHandler) ReindexAction(w http.ResponseWriter, req *http.Request
handler.WriteJSON(w, resResult, http.StatusOK) 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) client := elastic.GetClient(esName)
source := map[string]interface{}{ source := map[string]interface{}{
"index": body.Source.Index, "index": body.Source.Index,
@ -138,7 +138,7 @@ func (handler APIHandler) HandleGetRebuildListAction(w http.ResponseWriter, req
func SyncRebuildResult(esName string) error { func SyncRebuildResult(esName string) error {
client := elastic.GetClient(esName) 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)) esRes, err := client.SearchWithRawQueryDSL("infinireindex", []byte(esBody))
if err != nil { if err != nil {
return err 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.PUT, pathPrefix+"doc/:index/:id", handler.HandleUpdateDocumentAction)
ui.HandleUIMethod(api.DELETE, pathPrefix+"doc/:index/:id", handler.HandleDeleteDocumentAction) 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.GET, pathPrefix+"rebuild/_search", handler.HandleGetRebuildListAction)
ui.HandleUIMethod(api.DELETE, pathPrefix+"rebuild/:id", handler.HandleDeleteRebuildAction) ui.HandleUIMethod(api.DELETE, pathPrefix+"rebuild/:id", handler.HandleDeleteRebuildAction)
ui.HandleUIMethod(api.GET, pathPrefix+"_cat/indices", handler.HandleGetIndicesAction) ui.HandleUIMethod(api.GET, pathPrefix+"_cat/indices", handler.HandleGetIndicesAction)

View File

@ -70,7 +70,7 @@ func main() {
}, func() { }, func() {
orm.RegisterSchema(model.Dict{}) 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" ReindexStatusFailed ReindexStatus = "FAILED"
) )
type InfiniReindex struct { //const IndexReindex = ".reindex"
type Reindex struct {
ID string `json:"id" elastic_meta:"_id"` ID string `json:"id" elastic_meta:"_id"`
Name string `json:"name" elastic_mapping:"name:{type:text}"` Name string `json:"name" elastic_mapping:"name:{type:text}"`
Desc string `json:"desc" elastic_mapping:"desc:{type:text}"` Desc string `json:"desc" elastic_mapping:"desc:{type:text}"`

View File

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

View File

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

View File

@ -1,20 +1,238 @@
let data = { let data = {
"errmsg": "",
"errno": "0",
"payload": [ "payload": [
"blogs", {
"mock_log1", "health": "green",
"metricbeat-7.10.0-2020.12.24-000002", "index": "blogs",
"metricbeat-7.10.0-2020.11.24-000001", "uuid": "3YOmOx_BSDqF-6EqAzBLVg",
"infinireindex", "pri": "1",
"gateway_requests", "rep": "1",
"infini-test1", "docs.count": "3",
"dict", "docs.deleted": "0",
"infini-test", "store.size": "29.2kb",
"mock_log", "pri.store.size": "14.6kb"
"infini-test8", },
"infini-dict" {
] "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 = { const mappings = {
@ -45875,10 +46093,10 @@ const mappings = {
}; };
export default { export default {
// 'get /_search-center/indices/_cat': function(req, res){ 'get /_search-center/_cat/indices': function(req, res){
// res.send(data) res.send(data)
// }, },
// 'get /_search-center/indices/_mappings/:index': function(req, res){ 'get /_search-center/index/:index/_mappings': function(req, res){
// res.send(mappings) res.send(mappings)
// } }
} }

View File

@ -1,432 +1,533 @@
let data = { let data = {
"errmsg": "",
"errno": "0",
"payload": { "payload": {
"data": [ "took": 0,
{ "timed_out": false,
"_index": "infinireindex", "hits": {
"created_at": "2021-01-06T15:55:31.426604+08:00", "total": {
"desc": "test source index not exists", "relation": "eq",
"dest": { "value": 7
"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"
}
}
}, },
{ "max_score": 0,
"_index": "infinireindex", "hits": [
"created_at": "2021-01-06T15:48:46.585112+08:00", {
"desc": "test query param again", "_index": "infinireindex",
"dest": { "_type": "_doc",
"index": "infini-test8", "_id": "bvrdoldath27go6rq64g",
"pipeline": "" "_source": {
}, "created_at": "2021-01-07T18:03:01.769901+08:00",
"id": "bvqmmnlath24tgfo1070", "desc": "",
"name": "test query one", "dest": {
"source": { "index": "infini-test8",
"_source": [], "pipeline": ""
"index": "infini-test", },
"query": { "id": "bvrdoldath27go6rq64g",
"match": { "name": "test ddd",
"name": "cincky" "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", "_index": "infinireindex",
"task_source": { "_type": "_doc",
"completed": true, "_id": "bvqmpstath24tgfo107g",
"response": { "_source": {
"batches": 1, "created_at": "2021-01-06T15:55:31.426604+08:00",
"created": 0, "desc": "test source index not exists",
"deleted": 0, "dest": {
"failures": [], "index": "infini-test8",
"noops": 0, "pipeline": ""
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
}, },
"throttled": "0s", "id": "bvqmpstath24tgfo107g",
"throttled_millis": 0, "name": "test failed",
"throttled_until": "0s", "source": {
"throttled_until_millis": 0, "_source": [],
"timed_out": false, "index": "infini-testx",
"took": 44, "query": null
"total": 1, },
"updated": 1, "status": "FAILED",
"version_conflicts": 0 "task_id": "F0D6OfeVSzuMhf5528ANTw:824925",
}, "task_source": {
"task": { "completed": true,
"action": "indices:data/write/reindex", "error": {
"cancellable": true, "index": "infini-testx",
"description": "reindex from [infini-test] to [infini-test8][_doc]", "index_uuid": "_na_",
"headers": {}, "reason": "no such index [infini-testx]",
"id": 822567, "resource.id": "infini-testx",
"node": "F0D6OfeVSzuMhf5528ANTw", "resource.type": "index_or_alias",
"running_time_in_nanos": 44277146, "type": "index_not_found_exception"
"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, "task": {
"throttled_until_millis": 0, "action": "indices:data/write/reindex",
"total": 1, "cancellable": true,
"updated": 1, "description": "reindex from [infini-testx] to [infini-test8][_doc]",
"version_conflicts": 0 "headers": {},
}, "id": 824925,
"type": "transport" "node": "F0D6OfeVSzuMhf5528ANTw",
} "running_time_in_nanos": 172714,
} "start_time_in_millis": 1609919731425,
}, "status": {
{ "batches": 0,
"_index": "infinireindex", "created": 0,
"created_at": "2021-01-06T15:46:04.745132+08:00", "deleted": 0,
"desc": "test query param", "noops": 0,
"dest": { "requests_per_second": 0,
"index": "infini-test8", "retries": {
"pipeline": "" "bulk": 0,
}, "search": 0
"id": "bvqmlf5ath24tgfo106g", },
"name": "test query", "throttled_millis": 0,
"source": { "throttled_until_millis": 0,
"_source": [], "total": 0,
"index": "infini-test1", "updated": 0,
"query": { "version_conflicts": 0
"match": { },
"name": "test" "type": "transport"
}
} }
} }
}, },
"status": "SUCCEED", {
"task_id": "F0D6OfeVSzuMhf5528ANTw:821548", "_index": "infinireindex",
"task_source": { "_type": "_doc",
"completed": true, "_id": "bvqmmnlath24tgfo1070",
"response": { "_source": {
"batches": 0, "created_at": "2021-01-06T15:48:46.585112+08:00",
"created": 0, "desc": "test query param again",
"deleted": 0, "dest": {
"failures": [], "index": "infini-test8",
"noops": 0, "pipeline": ""
"requests_per_second": -1,
"retries": {
"bulk": 0,
"search": 0
}, },
"throttled": "0s", "id": "bvqmmnlath24tgfo1070",
"throttled_millis": 0, "name": "test query one",
"throttled_until": "0s", "source": {
"throttled_until_millis": 0, "_source": [],
"timed_out": false, "index": "infini-test",
"took": 0, "query": {
"total": 0, "match": {
"updated": 0, "name": "cincky"
"version_conflicts": 0 }
}, }
"task": { },
"action": "indices:data/write/reindex", "status": "SUCCEED",
"cancellable": true, "task_id": "F0D6OfeVSzuMhf5528ANTw:822567",
"description": "reindex from [infini-test1] to [infini-test8][_doc]", "task_source": {
"headers": {}, "completed": true,
"id": 821548, "response": {
"node": "F0D6OfeVSzuMhf5528ANTw", "batches": 1,
"running_time_in_nanos": 982379, "created": 0,
"start_time_in_millis": 1609919164744, "deleted": 0,
"status": { "failures": [],
"batches": 0, "noops": 0,
"created": 0, "requests_per_second": -1,
"deleted": 0, "retries": {
"noops": 0, "bulk": 0,
"requests_per_second": -1, "search": 0
"retries": { },
"bulk": 0, "throttled": "0s",
"search": 0 "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, "task": {
"throttled_until_millis": 0, "action": "indices:data/write/reindex",
"total": 0, "cancellable": true,
"updated": 0, "description": "reindex from [infini-test] to [infini-test8][_doc]",
"version_conflicts": 0 "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 { export default {
// 'get /_search-center/rebuild/list': function(req, res){ 'get /_search-center/rebuild/_search': function(req, res){
// res.send(data) res.send(data)
// } }
} }

View File

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