func createEsDefaultClient()

in action/log/logadapter/elasticsearch.go [75:95]


func createEsDefaultClient(currency *Currency) (*elasticsearch.Client, error) {
	// Configure the Elasticsearch client
	cfg := elasticsearch.Config{
		Addresses: []string{
			currency.Address,
		},
		Username: currency.Username,
		Password: currency.Password,
		// Skip certificate verification if using a self-signed certificate
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},
	}

	// Create the client instance
	es, err := elasticsearch.NewClient(cfg)
	if err != nil {
		return nil, fmt.Errorf("error creating the client: %s", err)
	}
	return es, nil
}