Documentation
¶
Index ¶
Constants ¶
const Version = version.Client
Version returns the package version as a string.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
Transport opensearchtransport.Interface
}
Client represents the OpenSearch client.
func NewClient ¶
NewClient creates a new client with configuration from cfg.
It will use http://localhost:9200 as the default address.
It will use the OPENSEARCH_URL/ELASTICSEARCH_URL environment variable, if set, to configure the addresses; use a comma to separate multiple URLs.
It's an error to set both OPENSEARCH_URL and ELASTICSEARCH_URL.
func NewDefaultClient ¶
NewDefaultClient creates a new client with default options.
It will use http://localhost:9200 as the default address.
It will use the OPENSEARCH_URL/ELASTICSEARCH_URL environment variable, if set, to configure the addresses; use a comma to separate multiple URLs.
It's an error to set both OPENSEARCH_URL and ELASTICSEARCH_URL.
func (*Client) DiscoverNodes ¶
DiscoverNodes reloads the client connections by fetching information from the cluster.
type Config ¶
type Config struct { Addresses []string // A list of nodes to use. Username string // Username for HTTP Basic Authentication. Password string // Password for HTTP Basic Authentication. Header http.Header // Global HTTP request header. Signer signer.Signer // PEM-encoded certificate authorities. // When set, an empty certificate pool will be created, and the certificates will be appended to it. // The option is only valid when the transport is not specified, or when it's http.Transport. CACert []byte RetryOnStatus []int // List of status codes for retry. Default: 502, 503, 504. DisableRetry bool // Default: false. EnableRetryOnTimeout bool // Default: false. MaxRetries int // Default: 3. CompressRequestBody bool // Default: false. DiscoverNodesOnStart bool // Discover nodes when initializing the client. Default: false. DiscoverNodesInterval time.Duration // Discover nodes periodically. Default: disabled. EnableMetrics bool // Enable the metrics collection. EnableDebugLogger bool // Enable the debug logging. RetryBackoff func(attempt int) time.Duration // Optional backoff duration. Default: nil. Transport http.RoundTripper // The HTTP transport object. Logger opensearchtransport.Logger // The logger object. Selector opensearchtransport.Selector // The selector object. // Optional constructor function for a custom ConnectionPool. Default: nil. ConnectionPoolFunc func([]*opensearchtransport.Connection, opensearchtransport.Selector) opensearchtransport.ConnectionPool }
Config represents the client configuration.