elasticsearch

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultURL = "http://elasticsearch:9200"
)

Variables

This section is empty.

Functions

func FormatError added in v0.13.0

func FormatError(err error) string

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

func (*Elasticsearch) Index

func (es *Elasticsearch) Index(ctx context.Context, esIndex string, esType string, body interface{}) error

Index store a document inside elastic search

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL