Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultDocumentOptions = &documentOptions{ refresh: refresh.False, }
Functions ¶
This section is empty.
Types ¶
type BulkAction ¶ added in v0.0.27
type BulkAction string
const ( BulkActionIndex BulkAction = "index" BulkActionCreate BulkAction = "create" BulkActionUpdate BulkAction = "update" BulkActionDelete BulkAction = "delete" )
type BulkOperation ¶ added in v0.0.27
type BulkOperation struct { IndexName string Action BulkAction DocumentID string Doc interface{} }
type Client ¶
type Client interface { // Init makes sure that the elastic server or cluster is configured for clinia Init(ctx context.Context) error // Clean makes sure the the elastic server or cluster removes all clinia configuration Clean(ctx context.Context) error ClientEngines }
Client provides access to a single Elastic server, or an entire cluster of Elastic servers.
type ClientEngines ¶
type ClientEngines interface { // Engine opens a connection to an exisiting engine. // If no engine with given name exists, a NotFoundError is returned. Engine(ctx context.Context, name string) (Engine, error) // EngineExists returns true if an engine with given name exists. EngineExists(ctx context.Context, name string) (bool, error) // Engines returns a list of all engines found by the client. Engines(ctx context.Context) ([]EngineInfo, error) // CreateEngine creates a new engine with given name and opens a connection to it. // If the a database with given name already exists, a DuplicateError is returned. CreateEngine(ctx context.Context, name string) (Engine, error) }
ClientEngines provides access to the engines in a single elastic server, or an entire cluster of elastic servers.
type CreateIndexOptions ¶
type CreateIndexOptions struct { Aliases map[string]types.Alias Settings *types.IndexSettings Mappings *types.TypeMapping }
CreateIndexOptions contains options that customize the creation of an index.
type DocumentMeta ¶
type DocumentOption ¶ added in v0.0.27
type DocumentOption func(*documentOptions)
func WithRefresh ¶ added in v0.0.27
func WithRefresh(refresh refresh.Refresh) DocumentOption
WithRefresh sets the refresh option of the document operation.
type Engine ¶
type Engine interface { // Name returns the name of the engine. Name() string // Info fetches the information about the engine. Info(ctx context.Context) (*EngineInfo, error) // Remove removes the entire engine. // If the engine does not exists, a NotFoundError us returned Remove(ctx context.Context) error // Index functions EngineIndexes // Query performs a search request to Elastic Search Query(ctx context.Context, query *search.Request, indices ...string) (*search.Response, error) // Queries performs a multi search request to Elastic Search Queries(ctx context.Context, queries ...MultiQuery) (*msearch.Response, error) // Bulk performs a bulk request to Elastic Search Bulk(ctx context.Context, ops []BulkOperation) (*bulk.Response, error) }
Engine provides access to all indexes in a single engine.
type EngineIndexes ¶
type EngineIndexes interface { // Index opens a connection to an exisiting index within the engine. // If no index with given name exists, a NotFoundError is returned. Index(ctx context.Context, name string) (Index, error) // IndexExists returns true if an index with given name exists within the engine. IndexExists(ctx context.Context, name string) (bool, error) // Indexes returns a list of all indexes in the engine. Indexes(ctx context.Context) ([]IndexInfo, error) // CreateIndex creates a new index, // with given name, and opens a connection to it. CreateIndex(ctx context.Context, name string, options *CreateIndexOptions) (Index, error) }
EngineIndexes provides access to all indexes in a single engine.
type EngineInfo ¶
type EngineInfo struct { // The name of the engine. Name string `json:"name,omitempty"` }
type Index ¶
type Index interface { // Name returns the name of the index. Info() IndexInfo // Engine returns the engine containing the index. Engine() Engine // Remove removes the entire index. // If the index does not exists, a NotFoundError is returned. Remove(ctx context.Context) error // All document functions IndexDocuments }
Index provides access to the information of an index.
type IndexDocuments ¶
type IndexDocuments interface { // DocumentExists checks if a document with given id exists in the index. DocumentExists(ctx context.Context, id string) (bool, error) // ReadDocument reads a single document with given id from the index. // The document data is stored into result, the document metadata is returned. // If no document exists with given id, a NotFoundError is returned. ReadDocument(ctx context.Context, id string, result interface{}) (*DocumentMeta, error) // CreateDocument creates a single document in the index. // The document data is loaded from the given document, the document metadata is returned. // If the document data already contains a `_key` field, this will be used as key of the new document, // otherwise a unique key is created. CreateDocument(ctx context.Context, document interface{}, opts ...DocumentOption) (*DocumentMeta, error) // ReplaceDocument replaces a single document with given key in the collection with the document given in the document argument. // The document metadata is returned. // If no document exists with given key, a NotFoundError is returned. ReplaceDocument(ctx context.Context, key string, document interface{}, opts ...DocumentOption) (*DocumentMeta, error) // DeleteDocument deletes a single document with given key in the collection. // No error is returned when the document is successfully deleted. // If no document exists with given key, a NotFoundError is returned. DeleteDocument(ctx context.Context, key string, opts ...DocumentOption) error }
type IndexName ¶ added in v0.0.27
type IndexName string
func NewIndexName ¶ added in v0.0.27
func (IndexName) EngineName ¶ added in v0.0.27
type MultiQuery ¶
type MultiQuery struct { IndexName string Request types.MultisearchBody }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.