package controller import ( "log" "net/http" "elasticstream/config" "elasticstream/source" "elasticstream/source/elastic" "github.com/gin-gonic/gin" ) var client *elastic.Client func Open(c *gin.Context) { log.Println(">>>> controller.Open()") defer log.Println("<<<< controller.Open()") client = elastic.NewClient() err := client.Configure(c, &config.Config{ Host: "http://test.urantiacloud.com:9200", Indexes: []string{"index-a", "index-b", "index-c"}, BatchSize: 100, DBPath: "index.db", }) if err != nil { c.Status(http.StatusInternalServerError) return } // get position from boltdb var positions []source.Position log.Printf("client: %#v\n", client) err = client.Open(c, positions) if err != nil { c.Status(http.StatusInternalServerError) return } c.Status(http.StatusOK) }