Skip to content

minghsu0107/go-elasticsearch-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Elasticsearch Example

Examples to show how to use go-elasticsearch, a Golang Elasticsearch client SDK.

Reference: https://github.com/elastic/go-elasticsearch

Client Configuration

tr := http.DefaultTransport.(*http.Transport).Clone()
tr.MaxIdleConns = 100
tr.MaxConnsPerHost = 100
tr.MaxIdleConnsPerHost = 100

cfg := elasticsearch.Config{
	Addresses: []string{"http://localhost:9200"},
	Transport: &tr,
}

es, err := elasticsearch.NewClient(cfg)