package elasticstream import ( "github.com/elastic/go-elasticsearch/v8" ) type Client struct { es *elasticsearch.Client config *Config ch chan Data } func NewClient(config *Config) (*Client, error) { client := &Client{ config: config, } cfg := elasticsearch.Config{ Addresses: []string{ config.Host, }, } es, err := elasticsearch.NewClient(cfg) if err != nil { return nil, err } client.es = es return client, nil } func (c *Client) Open() error { // Open a connection with ElasticSearch // create a buffer channel c.ch = make(chan Data, 1) for _, index := range c.config.Indexes { NewWorker(c, index) } return nil } func (c *Client) Read() (Data, error) { return Data{}, nil } // close the client func (c *Client) Teardown() error { return nil }