update for cluster api
This commit is contained in:
parent
47da5f73b6
commit
2b330a56a7
|
@ -1,14 +1,13 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"infini.sh/framework/core/api"
|
||||
"infini.sh/framework/core/task"
|
||||
"infini.sh/framework/core/ui"
|
||||
"infini.sh/search-center/api/index_management"
|
||||
"infini.sh/search-center/config"
|
||||
"infini.sh/search-center/api/system"
|
||||
"infini.sh/search-center/config"
|
||||
log "github.com/cihub/seelog"
|
||||
)
|
||||
|
||||
func Init(cfg *config.AppConfig) {
|
||||
|
@ -40,11 +39,11 @@ func Init(cfg *config.AppConfig) {
|
|||
ui.HandleUIMethod(api.GET, pathPrefix+"cluster/:cluster/version", handler.GetClusterVersion)
|
||||
|
||||
task.RegisterScheduleTask(task.ScheduleTask{
|
||||
Description: "sync reindex task result to index infinireindex",
|
||||
Description: "sync reindex task result",
|
||||
Task: func() {
|
||||
err := index_management.SyncRebuildResult(cfg.Elasticsearch)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
log.Error(err)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
@ -35,7 +35,8 @@ func (h *APIHandler) HandleCreateClusterAction(w http.ResponseWriter, req *http.
|
|||
conf.Created = time.Now()
|
||||
conf.Updated = conf.Created
|
||||
conf.ID = id
|
||||
ir, err := esClient.Index(orm.GetIndexName(model.ClusterConfig{}), "", id, conf)
|
||||
index:=orm.GetIndexName(model.ClusterConfig{})
|
||||
ir, err := esClient.Index(index, "", id, conf)
|
||||
if err != nil {
|
||||
resBody["error"] = err
|
||||
h.WriteJSON(w, resBody, http.StatusOK)
|
||||
|
|
6
main.go
6
main.go
|
@ -69,9 +69,9 @@ func main() {
|
|||
module.Start()
|
||||
|
||||
}, func() {
|
||||
orm.RegisterSchemaWithIndexName(model.Dict{}, "infini-dict")
|
||||
orm.RegisterSchemaWithIndexName(model.Reindex{}, "infini-reindex")
|
||||
orm.RegisterSchemaWithIndexName(model.ClusterConfig{}, "infini-cluster")
|
||||
orm.RegisterSchemaWithIndexName(model.Dict{}, "dict")
|
||||
orm.RegisterSchemaWithIndexName(model.Reindex{}, "reindex")
|
||||
orm.RegisterSchemaWithIndexName(model.ClusterConfig{}, "cluster")
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ const (
|
|||
ReindexStatusFailed ReindexStatus = "FAILED"
|
||||
)
|
||||
|
||||
//const IndexReindex = ".reindex"
|
||||
|
||||
type Reindex struct {
|
||||
ID string `json:"id" elastic_meta:"_id"`
|
||||
Name string `json:"name" elastic_mapping:"name:{type:text}"`
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
elasticsearch:
|
||||
- name: default
|
||||
enabled: true
|
||||
endpoint: https://192.168.3.98:8000
|
||||
index_prefix:
|
||||
endpoint: https://192.168.3.98:9200
|
||||
basic_auth:
|
||||
username: elastic
|
||||
password: ZBdkVQUUdF1Sir4X4BGB
|
||||
|
@ -28,7 +27,7 @@ modules:
|
|||
enabled: true
|
||||
init_template: true
|
||||
template_name: ".infini-search-center"
|
||||
index_prefix: ".infini-search-center-"
|
||||
index_prefix: ".infini-search-center_"
|
||||
|
||||
search-center:
|
||||
ui_path: .public
|
||||
|
|
Loading…
Reference in New Issue