Documentation ¶
Index ¶
- func CreateDefaultESClient() error
- func NewESClient(config *Config, httpHeader http.Header, httpTransport http.RoundTripper, ...) (*esv8.Client, error)
- func NewStarter(optCfg *OptionalConfig) *starter
- func XClient() *esv8.Client
- func XFClient(f func(c *esv8.Client) error) error
- type Config
- type ConnectionPoolFunc
- type EsCommon
- type OptionalConfig
- type RetryBackoffFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewESClient ¶
func NewESClient(config *Config, httpHeader http.Header, httpTransport http.RoundTripper, logger estransport.Logger, selector estransport.Selector, retryBackoffFunc RetryBackoffFunc, connectionPoolFunc ConnectionPoolFunc) (*esv8.Client, error)
*
- @Description: 创建可配置的ES Client
- @param config 用户配置信息
- @param httpHeader 设置API HTTP Header
- @param transport 设置API HTTP transport object
- @param logger 设置logger object
- @param selector 设置selector object
- @param retryBackoffFunc 设置可选的退避持续时间处理函数
- @param connectionPoolFunc 设置连接池处理函数
- @return *esv8.Client
- @return error
Types ¶
type Config ¶
type Config struct { // 自建服务的配置信息 Addresses []string // es服务的集群节点设置. Username string // 基于 HTTP Basic Authentication 的用户名 Password string // 基于 HTTP Basic Authentication 的密码鉴权 // elastic.io 云服务的配置信息,覆盖自建服务的配置 CloudID string // elastic.io服务的CloudID (https://elastic.co/cloud),需注册后获取 APIKey string // Base64-encoded token for authorization; if set, overrides username and password. // PEM-encoded 加密传输鉴权令牌. // 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 // API请求重试配置设置 RetryOnStatus []int // List of status codes for retry. Default: 502, 503, 504. DisableRetry bool // 禁用重试,Default: false. EnableRetryOnTimeout bool // 启用重试超时设置,Default: false. MaxRetries int // 最多重试次数,Default: 3. // 服务节点查找周期设置 DiscoverNodesOnStart bool // 是否初始化客户端时查找节点. Default: false. DiscoverNodesInterval time.Duration // 是否周期型查找节点. Default: disabled. // Metrics度量:聚合查询设置 EnableMetrics bool // 是否启用Metrics度量度量,类聚合查询 EnableDebugLogger bool // 是否在debug时启用日志记录 }
func DefaultConfig ¶
func DefaultConfig() *Config
type ConnectionPoolFunc ¶
type ConnectionPoolFunc func([]*estransport.Connection, estransport.Selector) estransport.ConnectionPool
type OptionalConfig ¶
type OptionalConfig struct { HttpHeader http.Header // 设置API HTTP Header HttpTransport http.RoundTripper // 设置API HTTP transport object Logger estransport.Logger // 设置logger object Selector estransport.Selector // 设置selector object RetryBackoffFunc RetryBackoffFunc // 设置可选的退避持续时间处理函数 ConnectionPoolFunc ConnectionPoolFunc // 设置连接池处理函数 }
可选配置设置
type RetryBackoffFunc ¶
Click to show internal directories.
Click to hide internal directories.