Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Client ¶
func Client(s bandmaster.Service) *elastic.Client
Client returns the underlying `elastic.Client` of the given service.
It assumes that the service is ready; i.e. it might return nil if it's actually not.
NOTE: This will panic if `s` is not a `es.Service`.
func New ¶
func New(conf *Config) bandmaster.Service
New creates a new ElasticSearch (v2) service using the provided configuration. You may use the helpers for environment-based configuration to get a pre-configured `Config` with sane defaults.
It doesn't open any connection nor does it do any kind of I/O; i.e. it cannot fail.
Types ¶
type Config ¶
type Config struct { Addr string Opts []elastic.ClientOptionFunc }
Config contains the necessary configuration for an ElasticSearch (v5) service.
type Env ¶
type Env struct {
Addr string `envconfig:"ADDR" default:"http://localhost:9205"`
}
Env can be used to configure an ElasticSearch (v5) session via the environment.
It comes with sane defaults for a local development set-up.
type Service ¶
type Service struct { *bandmaster.ServiceBase // "inheritance" // contains filtered or unexported fields }
Service implements an ElasticSearch (v5) service based on the 'olivere/elastic.v5' package.
func (*Service) Start ¶
Start opens a connection and pings the server: if everything goes smoothly, the service is marked as 'started'; otherwise, an error is returned.
The given context is forwarded to the elastic SDK.
Start is used by BandMaster's internal machinery, it shouldn't ever be called directly by the end-user of the service.