package controller import ( "net/http" "elasticstream/config" "elasticstream/source" "elasticstream/source/elastic" "github.com/gin-gonic/gin" ) var client *elastic.Client func Open(c *gin.Context) { 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 err = client.Open(c, positions) if err != nil { c.Status(http.StatusInternalServerError) return } c.Status(http.StatusOK) }