add refresh index api
This commit is contained in:
parent
9be1f412de
commit
9b3005e005
|
@ -39,6 +39,7 @@ func InitAPI() {
|
|||
|
||||
api.HandleAPIMethod(api.POST, "/elasticsearch/:id/index/:index/_partition", handler.getIndexPartitionInfo)
|
||||
api.HandleAPIMethod(api.POST, "/elasticsearch/:id/index/:index/_count", handler.countDocuments)
|
||||
api.HandleAPIMethod(api.POST, "/elasticsearch/:id/index/:index/_refresh", handler.refreshIndex)
|
||||
api.HandleAPIMethod(api.POST, "/migration/data/:task_id/_start", handler.RequirePermission(handler.startDataMigration, enum.PermissionTaskWrite))
|
||||
api.HandleAPIMethod(api.POST, "/migration/data/:task_id/_stop", handler.RequirePermission(handler.stopDataMigrationTask, enum.PermissionTaskWrite))
|
||||
//api.HandleAPIMethod(api.GET, "/migration/data/:task_id", handler.getMigrationTask)
|
||||
|
@ -1065,6 +1066,23 @@ func (h *APIHandler) deleteDataMigrationTask(w http.ResponseWriter, req *http.Re
|
|||
}, 200)
|
||||
}
|
||||
|
||||
func (h *APIHandler) refreshIndex(w http.ResponseWriter, req *http.Request, ps httprouter.Params){
|
||||
var (
|
||||
index = ps.MustGetParameter("index")
|
||||
clusterID = ps.MustGetParameter("id")
|
||||
)
|
||||
client := elastic.GetClient(clusterID)
|
||||
err := client.Refresh(index)
|
||||
if err != nil {
|
||||
h.WriteError(w, err.Error(), http.StatusInternalServerError)
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
h.WriteJSON(w, util.MapStr{
|
||||
"success": true,
|
||||
}, 200)
|
||||
}
|
||||
|
||||
func getMajorTaskStatsFromInstances(majorTaskID string) (taskStats migration_model.MajorTaskState, err error) {
|
||||
taskQuery := util.MapStr{
|
||||
"size": 500,
|
||||
|
|
Loading…
Reference in New Issue