Documentation
¶
Index ¶
- Variables
- type API
- func (api *API) AddDocument(ctx context.Context, indexName string, bytes []byte) (int, error)
- func (api *API) BulkRequest(ctx context.Context, indexName string, documents []interface{}) (int, error)
- func (api *API) CallElastic(ctx context.Context, path, method string, payload interface{}) ([]byte, int, error)
- func (api *API) CreateSearchIndex(ctx context.Context, indexName string, mappingsFile string) (int, error)
- func (api *API) DeleteSearchIndex(ctx context.Context, indexName string) (int, error)
- func (api *API) QueryDatasetSearch(ctx context.Context, indexName string, query interface{}, limit, offset int) (*models.SearchResponse, int, error)
- func (api *API) SingleRequest(ctx context.Context, indexName string, document interface{}) (int, error)
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 ¶
NewElasticSearchAPI creates an ElasticSearchAPI object
func (*API) AddDocument ¶
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 ¶
DeleteSearchIndex removes an index from elastic search
Click to show internal directories.
Click to hide internal directories.