elasticsearch

package
v0.0.0-...-f24859d Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorUnexpectedStatusCode = errors.New("unexpected status code from api")

ErrorUnexpectedStatusCode represents the error message to be returned when the status received from elastic is not as expected

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API aggregates a client and URL and other common data for accessing the API

func NewElasticSearchAPI

func NewElasticSearchAPI(clienter dphttp.Clienter, elasticSearchAPIURL string) *API

NewElasticSearchAPI creates an ElasticSearchAPI object

func (*API) AddDocument

func (api *API) AddDocument(ctx context.Context, indexName string, bytes []byte) (int, error)

AddDocument adds a document to an elasticsearch index

func (*API) BulkRequest

func (api *API) BulkRequest(ctx context.Context, indexName string, documents []interface{}) (int, error)

BulkRequest ...

func (*API) CallElastic

func (api *API) CallElastic(ctx context.Context, path, method string, payload interface{}) ([]byte, int, error)

CallElastic builds a request to elastic search based on the method, path and payload

func (*API) CreateSearchIndex

func (api *API) CreateSearchIndex(ctx context.Context, indexName string, mappingsFile string) (int, error)

CreateSearchIndex creates a new index in elastic search

func (*API) DeleteSearchIndex

func (api *API) DeleteSearchIndex(ctx context.Context, indexName string) (int, error)

DeleteSearchIndex removes an index from elastic search

func (*API) QueryDatasetSearch

func (api *API) QueryDatasetSearch(ctx context.Context, indexName string, query interface{}, limit, offset int) (*models.SearchResponse, int, error)

QueryDatasetSearch ...

func (*API) SingleRequest

func (api *API) SingleRequest(ctx context.Context, indexName string, document interface{}) (int, error)

SingleRequest ...

Jump to

Keyboard shortcuts

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