Documentation ¶
Index ¶
- Constants
- type AggregationBucket
- type AggregationResponse
- type AggregationResponses
- type Builder
- func (b *Builder) Aggregate() (map[string]*AggregationResponse, error)
- func (b *Builder) AggregateRaw() (*gabs.Container, error)
- func (b *Builder) CancelTask(taskId string) (*gabs.Container, error)
- func (qb *Builder) Clear() *queryBuilder
- func (b *Builder) ClearScroll() error
- func (b *Builder) Client() *elastic.Client
- func (b *Builder) Count() (int64, error)
- func (b *Builder) Cursor(offset int, sortValues []interface{}, items interface{}) ([]interface{}, error)
- func (b *Builder) Delete(ids ...string) (*gabs.Container, error)
- func (b *Builder) Destroy() (*gabs.Container, error)
- func (b *Builder) DestroyAsync() (*gabs.Container, error)
- func (b *Builder) Execute(params map[string]interface{}) (*gabs.Container, error)
- func (b *Builder) ExecuteAsync(scrollSize int, params map[string]interface{}) (*gabs.Container, error)
- func (qb *Builder) Filter(field string, operand string, value interface{}) *queryBuilder
- func (qb *Builder) FilterIn(field string, values []interface{}) *queryBuilder
- func (qb *Builder) FilterInNested(field string, values []interface{}) *queryBuilder
- func (qb *Builder) FilterNested(field string, operand string, value interface{}) *queryBuilder
- func (b *Builder) Find(id string, item interface{}) error
- func (qb *Builder) From(value int) *queryBuilder
- func (b *Builder) Get(items interface{}) error
- func (b *Builder) GetTask(taskId string, waitForCompletion bool) (*gabs.Container, error)
- func (qb *Builder) GroupBy(fields ...string) *queryBuilder
- func (b *Builder) InitScroller(size int, scroll string) *Builder
- func (b *Builder) InitSlicedScroller(id, max, size int, scroll string) *Builder
- func (b *Builder) Insert(items ...interface{}) (*gabs.Container, error)
- func (b *Builder) InsertWithOverwrittenId(items map[string]interface{}) (*gabs.Container, error)
- func (qb *Builder) Limit(value int) *queryBuilder
- func (qb *Builder) Match(field string, operand string, value interface{}) *queryBuilder
- func (qb *Builder) MatchIn(field string, values []interface{}) *queryBuilder
- func (qb *Builder) MatchInNested(field string, values []interface{}) *queryBuilder
- func (qb *Builder) MatchNested(field string, operand string, value interface{}) *queryBuilder
- func (qb *Builder) MatchNotIn(field string, values []interface{}) *queryBuilder
- func (qb *Builder) MatchNotInNested(field string, values []interface{}) *queryBuilder
- func (qb *Builder) MatchPhrase(field string, operand string, value interface{}) *queryBuilder
- func (qb *Builder) MatchPhraseIn(field string, values []interface{}) *queryBuilder
- func (qb *Builder) MatchPhraseInNested(field string, values []interface{}) *queryBuilder
- func (qb *Builder) MatchPhraseNested(field string, operand string, value interface{}) *queryBuilder
- func (qb *Builder) MatchPhraseNotIn(field string, values []interface{}) *queryBuilder
- func (qb *Builder) MatchPhraseNotInNested(field string, values []interface{}) *queryBuilder
- func (b *Builder) MinMax(field string, isDateField bool) (*MinMaxResponse, error)
- func (qb *Builder) OrderBy(field string, asc bool) *queryBuilder
- func (qb *Builder) OrderByNested(path string, order bool) *queryBuilder
- func (b *Builder) RawQuery(query string) elastic.Query
- func (b *Builder) Scroll() (*gabs.Container, error)
- func (qb *Builder) Stats(fields ...string) *queryBuilder
- func (b *Builder) Update(items ...interface{}) (*gabs.Container, error)
- func (qb *Builder) Where(field string, operand string, value interface{}) *queryBuilder
- func (qb *Builder) WhereIn(field string, values []interface{}) *queryBuilder
- func (qb *Builder) WhereInNested(field string, values []interface{}) *queryBuilder
- func (qb *Builder) WhereNested(field string, operand string, value interface{}) *queryBuilder
- func (qb *Builder) WhereNotIn(field string, values []interface{}) *queryBuilder
- func (qb *Builder) WhereNotInNested(field string, values []interface{}) *queryBuilder
- type Connection
- type ConnectionContext
- type IndexOptions
- type Indexer
- func (i *Indexer) AddAlias(indexName string, aliasName string) (*gabs.Container, error)
- func (i *Indexer) AddAliasByAction(aliasAction *elastic.AliasAddAction) (*gabs.Container, error)
- func (i *Indexer) AliasAddAction(alias string) *elastic.AliasAddAction
- func (i *Indexer) Aliases(indices ...string) (*gabs.Container, error)
- func (i *Indexer) AliasesCat() (*gabs.Container, error)
- func (i *Indexer) Close(name string) (*gabs.Container, error)
- func (i *Indexer) CreateIndex(name string, schema string) error
- func (i *Indexer) CreateRepository(repository string, repoType string, verify bool, ...) (*gabs.Container, error)
- func (i *Indexer) DeleteIndex(name string) error
- func (i *Indexer) DeleteRepositories(repositories ...string) (*gabs.Container, error)
- func (i *Indexer) DeleteSnapshot(repository string, name string) (*gabs.Container, error)
- func (i *Indexer) Exists(name string) (bool, error)
- func (i *Indexer) FieldMappings(indices ...string) (*gabs.Container, error)
- func (i *Indexer) GetClusterHealth(indices ...string) (*gabs.Container, error)
- func (i *Indexer) GetIndices(indices ...string) (*gabs.Container, error)
- func (i *Indexer) GetSnapshots(repository string, snapshot string) (*gabs.Container, error)
- func (i *Indexer) GetTask(taskId string) (*gabs.Container, error)
- func (i *Indexer) IndexCat(name string) (*gabs.Container, error)
- func (i *Indexer) IndexStats(indices ...string) (map[string]*gabs.Container, error)
- func (i *Indexer) ListAllIndices() ([]string, error)
- func (i *Indexer) ListIndices() ([]string, error)
- func (i *Indexer) ListSnapshots(repository string) ([]string, error)
- func (i *Indexer) Mappings(indices ...string) (*gabs.Container, error)
- func (i *Indexer) Open(name string) (*gabs.Container, error)
- func (i *Indexer) PutSettings(body string, indices ...string) (*gabs.Container, error)
- func (i *Indexer) Recovery(indices ...string) (map[string]*gabs.Container, error)
- func (i *Indexer) RemoveIndexFromAlias(index string, alias string) (*gabs.Container, error)
- func (i *Indexer) Rollover(alias, newIndex, maxAge, maxSize string, maxDocs int64, ...) (*gabs.Container, error)
- func (i *Indexer) SetOptions(options *IndexOptions)
- func (i *Indexer) Settings(names ...string) (map[string]*gabs.Container, error)
- func (i *Indexer) Snapshot(repository string, snapshot string, indices ...string) (*gabs.Container, error)
- func (i *Indexer) SnapshotRestore(repository string, snapshot string) (*gabs.Container, error)
- func (i *Indexer) Templates(indexTemplates ...string) (*gabs.Container, error)
- type MinMaxResponse
Constants ¶
const CONCURRENT_BATCH int = 10
CONCURRENT_BATCH is the default concurrent response proccesing batch size
const LIMIT int = 10000
LIMIT is the default limit of documents to be returned by elasticsearch
const VALUE string = "value"
VALUE self EXPLANATORY
const VALUE_AS_STRING string = "value_as_string"
VALUE_AS_STRING self explanatory
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregationBucket ¶
type AggregationBucket struct { Key interface{} `json:"key"` DocCount int `json:"doc_count"` Items map[string]*AggregationResponse `json:"items"` }
AggregationBucket represents a bucket within an AggregationResponse
type AggregationResponse ¶
type AggregationResponse struct { DocCountErrorUpperBound int `json:"doc_count_error_upper_bound"` SumOtherDocCount int `json:"sum_other_doc_count"` Buckets []*AggregationBucket `json:"buckets"` }
AggregationResponse represents an aggregation's query response
func (*AggregationResponse) ToGabsContainer ¶
func (ab *AggregationResponse) ToGabsContainer() (*gabs.Container, error)
ToGabsContainer converts a response to a *gabs.Container instance
type AggregationResponses ¶
type AggregationResponses map[string]*AggregationResponse
AggregationResponses represents a map for *AggregationResponse
func (*AggregationResponses) ToGabsContainer ¶
func (ar *AggregationResponses) ToGabsContainer() (*gabs.Container, error)
ToGabsContainer converts a response to a *gabs.Container instance
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder represents the struct in charge of building and executing elasticsearch queries
func (*Builder) Aggregate ¶
func (b *Builder) Aggregate() (map[string]*AggregationResponse, error)
Aggregate retrieves all the queries aggregations
func (*Builder) AggregateRaw ¶
AggregateRaw returns raw aggregation results
func (*Builder) CancelTask ¶
CancelTask cancels a task provided a taskId
func (*Builder) ClearScroll ¶
ClearScroll cancel's the current scroll operation
func (*Builder) Cursor ¶
func (b *Builder) Cursor(offset int, sortValues []interface{}, items interface{}) ([]interface{}, error)
Cursor paginates based on searching after the last returned sortValues
func (*Builder) Delete ¶
Delete deletes one or multiple documents by id from the corresponding elasticsearch index
func (*Builder) DestroyAsync ¶
DestroyAsync executes a delete by query asynchronously
func (*Builder) ExecuteAsync ¶
func (b *Builder) ExecuteAsync(scrollSize int, params map[string]interface{}) (*gabs.Container, error)
ExecuteAsync executes an update by query asynchronously
func (*Builder) FilterIn ¶
func (qb *Builder) FilterIn(field string, values []interface{}) *queryBuilder
func (*Builder) FilterInNested ¶
func (qb *Builder) FilterInNested(field string, values []interface{}) *queryBuilder
func (*Builder) FilterNested ¶
func (*Builder) Find ¶
Find retrieves an instance of a model for the specified Id from the corresponding elasticsearch index
func (*Builder) InitScroller ¶
InitScroller initializes the scroller
func (*Builder) InitSlicedScroller ¶
InitSlicedScroller boots a sliced scroller
func (*Builder) Insert ¶
Insert inserts one or multiple documents into the corresponding elasticsearch index
func (*Builder) InsertWithOverwrittenId ¶
InsertWithOverwrittenId allows to overwrite the of the given document on creation
func (*Builder) MatchIn ¶
func (qb *Builder) MatchIn(field string, values []interface{}) *queryBuilder
func (*Builder) MatchInNested ¶
func (qb *Builder) MatchInNested(field string, values []interface{}) *queryBuilder
func (*Builder) MatchNested ¶
func (*Builder) MatchNotIn ¶
func (qb *Builder) MatchNotIn(field string, values []interface{}) *queryBuilder
func (*Builder) MatchNotInNested ¶
func (qb *Builder) MatchNotInNested(field string, values []interface{}) *queryBuilder
func (*Builder) MatchPhrase ¶
func (*Builder) MatchPhraseIn ¶
func (qb *Builder) MatchPhraseIn(field string, values []interface{}) *queryBuilder
func (*Builder) MatchPhraseInNested ¶
func (qb *Builder) MatchPhraseInNested(field string, values []interface{}) *queryBuilder
func (*Builder) MatchPhraseNested ¶
func (*Builder) MatchPhraseNotIn ¶
func (qb *Builder) MatchPhraseNotIn(field string, values []interface{}) *queryBuilder
func (*Builder) MatchPhraseNotInNested ¶
func (qb *Builder) MatchPhraseNotInNested(field string, values []interface{}) *queryBuilder
func (*Builder) MinMax ¶
func (b *Builder) MinMax(field string, isDateField bool) (*MinMaxResponse, error)
MinMax returns the minimum and maximum values for a given field on an index
func (*Builder) OrderByNested ¶
func (*Builder) Update ¶
Update updates one or multiple documents from the corresponding elasticsearch index
func (*Builder) WhereIn ¶
func (qb *Builder) WhereIn(field string, values []interface{}) *queryBuilder
func (*Builder) WhereInNested ¶
func (qb *Builder) WhereInNested(field string, values []interface{}) *queryBuilder
func (*Builder) WhereNested ¶
func (*Builder) WhereNotIn ¶
func (qb *Builder) WhereNotIn(field string, values []interface{}) *queryBuilder
func (*Builder) WhereNotInNested ¶
func (qb *Builder) WhereNotInNested(field string, values []interface{}) *queryBuilder
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents an elasticsearch connection
func NewConnection ¶
func NewConnection(context *ConnectionContext) *Connection
NewConnection creates an elasticsearch connection
func (*Connection) Builder ¶
func (c *Connection) Builder(index string) *Builder
Builder creates a new Builder
func (*Connection) Connect ¶
func (c *Connection) Connect() error
Connect initializes an Elastic Client
func (*Connection) Indexer ¶
func (c *Connection) Indexer(options *IndexOptions) *Indexer
Indexer creates a new indexer
type ConnectionContext ¶
type ConnectionContext struct { Urls []string Sniff bool HealthCheckInterval int64 ErrorLogPrefix string InfoLogPrefix string Password string Username string Context context.Context }
ConnectionContext sets the connection configuration
type IndexOptions ¶
type IndexOptions struct { WaitForCompletion bool IncludeGlobalState bool Partial bool IncludeAliases bool Timeout string RenamePattern string RenameReplacement string Indices []string IndexSettings map[string]interface{} }
IndexOptions are options that can be passed as elasticsearch parameters
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer represents a struct that performs different actions on elasticsearch indices
func (*Indexer) AddAliasByAction ¶
AddAliasByAction adds an alias by *elastic.AliasAddAction
func (*Indexer) AliasAddAction ¶
func (i *Indexer) AliasAddAction(alias string) *elastic.AliasAddAction
AliasAddAction returns an instances of *elastic.AliasAddAction
func (*Indexer) AliasesCat ¶
AliasesCat retrives information associated to all current index aliases
func (*Indexer) CreateIndex ¶
CreateIndex creates and ElasticSearch index
func (*Indexer) CreateRepository ¶
func (i *Indexer) CreateRepository(repository string, repoType string, verify bool, settings map[string]interface{}) (*gabs.Container, error)
CreateRepository creates a snapshot repository
func (*Indexer) DeleteIndex ¶
DeleteIndex deletes an ElasticSearch Index
func (*Indexer) DeleteRepositories ¶
DeleteRepositories deletes one or many snapshot repositories
func (*Indexer) DeleteSnapshot ¶
DeleteSnapshot deletes a snapshot for a given repository
func (*Indexer) FieldMappings ¶
FieldMappings returns the field mappings for the specified indices
func (*Indexer) GetClusterHealth ¶
GetClusterHealth returns the health status of the cluster
func (*Indexer) GetIndices ¶
GetIndices returns index information for the provided indices
func (*Indexer) GetSnapshots ¶
GetSnapshots retrives information regarding snapshots in a given repository
func (*Indexer) IndexStats ¶
IndexStats retrieves the statistics for the given indices
func (*Indexer) ListAllIndices ¶
ListAllIndices lists all indices on and elasticsearch cluster
func (*Indexer) ListIndices ¶
ListIndices lists all open inidces on an elsasticsearch cluster
func (*Indexer) ListSnapshots ¶
ListSnapshots returns a list of snapshots for the given repository
func (*Indexer) PutSettings ¶
PutSettings updates elasticsearch indices settings
func (*Indexer) RemoveIndexFromAlias ¶
RemoveIndexFromAlias removes an index from a given alias
func (*Indexer) Rollover ¶
func (i *Indexer) Rollover(alias, newIndex, maxAge, maxSize string, maxDocs int64, settings map[string]interface{}) (*gabs.Container, error)
Rollover executes an index rollover if the given conditions are met
func (*Indexer) SetOptions ¶
func (i *Indexer) SetOptions(options *IndexOptions)
SetOptions sets the index options for the action to be performed
func (*Indexer) Snapshot ¶
func (i *Indexer) Snapshot(repository string, snapshot string, indices ...string) (*gabs.Container, error)
Snapshot takes a snapshot of one or more indices and stores it in the provided repository
func (*Indexer) SnapshotRestore ¶
SnapshotRestore restores a snapshot from the specified repository
type MinMaxResponse ¶
type MinMaxResponse struct { Min interface{} `json:"min"` Max interface{} `json:"max"` }
MinMaxResponse is the response for the MinMax builder call
func (*MinMaxResponse) ToGabsContainer ¶
func (mmr *MinMaxResponse) ToGabsContainer() (*gabs.Container, error)
ToGabsContainer converts a response to a *gabs.Container instance