Documentation
¶
Index ¶
- type Elasticsearch
- type Hits
- type Option
- func WithAddresses(addresses []string) Option
- func WithApiKey(apiKey string) Option
- func WithCACert(caCert string) Option
- func WithCertificateFingerprint(certificateFingerprint string) Option
- func WithCloudID(cloudId string) Option
- func WithCompressRequestBody(compressRequestBody bool) Option
- func WithDisableMetaHeader(disableMetaHeader bool) Option
- func WithDisableRetry(disableRetry bool) Option
- func WithDiscoverNodesInterval(discoverNodesInterval time.Duration) Option
- func WithDiscoverNodesOnStart(discoverNodesOnStart bool) Option
- func WithEnableCompatibilityMode(enableCompatibilityMode bool) Option
- func WithEnableDebugLogger(enableDebugLogger bool) Option
- func WithEnableMetrics(enableMetrics bool) Option
- func WithHeader(header map[string][]string) Option
- func WithMaxRetries(maxRetries int) Option
- func WithPassword(password string) Option
- func WithRetryOnStatus(retryOnStatus []int) Option
- func WithServiceToken(serviceToken string) Option
- func WithUsername(username string) Option
- type Options
- type QueryResponse
- type Shards
- type SubHits
- type Total
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Elasticsearch ¶
type Elasticsearch struct {
*elasticsearch.Client
// contains filtered or unexported fields
}
func New ¶
func New(opts ...Option) *Elasticsearch
func (*Elasticsearch) Init ¶
func (es *Elasticsearch) Init(opts ...Option) error
func (*Elasticsearch) Provide ¶
func (es *Elasticsearch) Provide(ctx context.Context) interface{}
type Option ¶
type Option func(*Options)
func WithAddresses ¶
func WithApiKey ¶
func WithCACert ¶
func WithCloudID ¶
func WithCompressRequestBody ¶
func WithDisableMetaHeader ¶
func WithDisableRetry ¶
func WithEnableDebugLogger ¶
func WithEnableMetrics ¶
func WithHeader ¶
func WithMaxRetries ¶
func WithPassword ¶
func WithRetryOnStatus ¶
func WithServiceToken ¶
func WithUsername ¶
type Options ¶
type Options struct {
Addresses []string // A list of Elasticsearch nodes to use.
Username string // Username for HTTP Basic Authentication.
Password string // Password for HTTP Basic Authentication.
CloudID string // Endpoint for the Elastic Service (https://elastic.co/cloud).
APIKey string // Base64-encoded token for authorization; if set, overrides username/password and service token.
ServiceToken string // Service token for authorization; if set, overrides username/password.
CertificateFingerprint string // SHA256 hex fingerprint given by Elasticsearch on first launch.
Header http.Header // Global HTTP request header.
// 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 string
RetryOnStatus []int // List of status codes for retry. Default: 502, 503, 504.
DisableRetry bool // Default: false.
MaxRetries int // Default: 3.
RetryOnError func(*http.Request, error) bool // Optional function allowing to indicate which error should be retried. Default: nil.
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.
EnableCompatibilityMode bool // Enable sends compatibility header
DisableMetaHeader bool // Disable the additional "X-Elastic-Client-Meta" HTTP header.
}
type QueryResponse ¶
Click to show internal directories.
Click to hide internal directories.