Documentation ¶
Index ¶
- Constants
- func FormatError(err error) string
- type Elasticsearch
- func (es *Elasticsearch) Connect() (err error)
- func (es *Elasticsearch) CreateIndexIfNotExists(ctx context.Context, esIndex string, esType string, mapping string) error
- func (es *Elasticsearch) GetClient() *elastic.Client
- func (es *Elasticsearch) Index(ctx context.Context, esIndex string, esType string, body interface{}) error
Constants ¶
View Source
const (
DefaultURL = "http://elasticsearch:9200"
)
Variables ¶
This section is empty.
Functions ¶
func FormatError ¶ added in v0.13.0
FormatError formats an elastic.Error
Types ¶
type Elasticsearch ¶
type Elasticsearch struct {
// contains filtered or unexported fields
}
Elasticsearch wrapper
func NewClient ¶
func NewClient(url string, timeout time.Duration) *Elasticsearch
NewClient instantiates an Elasticsearch wrapper
func (*Elasticsearch) Connect ¶
func (es *Elasticsearch) Connect() (err error)
Connect connects to Elasticsearch
func (*Elasticsearch) CreateIndexIfNotExists ¶
func (es *Elasticsearch) CreateIndexIfNotExists(ctx context.Context, esIndex string, esType string, mapping string) error
CreateIndexIfNotExists Creates an index if it doesn't already exists
func (*Elasticsearch) GetClient ¶
func (es *Elasticsearch) GetClient() *elastic.Client
GetClient returns the native elastic search client
Click to show internal directories.
Click to hide internal directories.