Documentation ¶
Overview ¶
Package elasticsearch provides a Driver for the ElasticSerach search engine.
The elasticsearch.Client wraps both the official ElasticSearch client and the olivere/elastic search DSL. Ikuzo package should not directly use these libraries but use this wrapper client instead.
Index ¶
- Constants
- Variables
- type Alias
- type Client
- func (c *Client) Alias() Alias
- func (c *Client) CreateDefaultMappings(orgs []domain.OrganizationConfig, withAlias, withReset bool) (indices []string, err error)
- func (c *Client) GetResourceEntryStats(field string, r *http.Request) (*elastic.SearchResult, error)
- func (c *Client) Indices() Indices
- func (c *Client) NewBulkIndexer(orgs []domain.OrganizationConfig, workers int) (esutil.BulkIndexer, error)
- func (c *Client) NewOAIPMHStore() (*OAIPMHStore, error)
- func (c *Client) NewSitemapStore() *SitemapStore
- func (c *Client) Ping() (*externalAPI.Response, error)
- type Config
- type Debug
- type ErrorType
- type IndexNames
- func (in IndexNames) FragmentIndexName(orgID string) string
- func (in IndexNames) GetDigitalObjectIndexName(orgID, suffix string) string
- func (in IndexNames) GetIndexName(orgID string) string
- func (in IndexNames) GetSuggestIndexName(orgID string) string
- func (in IndexNames) GetV1IndexName(orgID string) string
- type Indices
- func (idx *Indices) Create(alias, mapping string, withAlias bool) (indexName string, err error)
- func (idx *Indices) Delete(indexName string) error
- func (idx Indices) Exists(indexName string) error
- func (idx *Indices) List() ([]string, error)
- func (idx *Indices) Switch(alias, newIndexName string, deleteOldIndex bool) (oldIndexName string, err error)
- type OAIPMHStore
- func (o *OAIPMHStore) GetRecord(ctx context.Context, q *oaipmh.RequestConfig) (record oaipmh.Record, errors []oaipmh.Error, err error)
- func (o *OAIPMHStore) ListIdentifiers(ctx context.Context, q *oaipmh.RequestConfig) (res oaipmh.Resumable, err error)
- func (o *OAIPMHStore) ListMetadataFormats(ctx context.Context, q *oaipmh.RequestConfig) (formats []oaipmh.MetadataFormat, err error)
- func (o *OAIPMHStore) ListRecords(ctx context.Context, q *oaipmh.RequestConfig) (res oaipmh.Resumable, err error)
- func (o *OAIPMHStore) ListSets(ctx context.Context, q *oaipmh.RequestConfig) (res oaipmh.Resumable, err error)
- type Proxy
- type QueryBuilder
- type QueryField
- type Response
- type SitemapStore
- func (s *SitemapStore) Datasets(ctx context.Context, cfg sitemap.Config) ([]sitemap.Location, error)
- func (s *SitemapStore) LocationCount(ctx context.Context, cfg sitemap.Config) (int, error)
- func (s *SitemapStore) Locations(ctx context.Context, cfg sitemap.Config, start, end int) []sitemap.Location
Constants ¶
const ( PathOrgID string = "meta.orgID" PathDatasetID string = "meta.spec" PathRevision string = "meta.revision" PathTags string = "meta.tags" )
Variables ¶
var ( ErrAliasNotFound = errors.New("alias not found") ErrAliasAlreadyCreated = errors.New("alias is already created") ErrIndexNotFound = errors.New("index not found") ErrIndexAlreadyCreated = errors.New("index already created") ErrIndexMappingNotValid = errors.New("parsing error in mapping") )
var ErrConfigMissingRequiredValue = errors.New("missing required configuration value")
Functions ¶
This section is empty.
Types ¶
type Alias ¶
type Alias struct {
// contains filtered or unexported fields
}
func (*Alias) Create ¶
Create creates an alias for the given indexName.
When the index does not exist ErrIndexNotExists is returned When the alias is already defined, ErrAliasExist is returned
func (*Alias) Delete ¶
Delete removes the alias from the index it is linked to.
When the alias does not it exist it will return a ErrAliasNotExist error.
When the indexName is empty it will search for the indexName using GetAlias().
func (*Alias) Get ¶
Get returns the indexName for the given alias.
When the alias is not found an ErrAliasNotFound error is returned.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client to interact with the ElasticSearch cluster. Must be used via NewClient to have proper initialisation.
func (*Client) CreateDefaultMappings ¶
func (c *Client) CreateDefaultMappings(orgs []domain.OrganizationConfig, withAlias, withReset bool) (indices []string, err error)
CreateDefaultMappings creates index mappings for all supplied organizations
func (*Client) GetResourceEntryStats ¶
func (*Client) NewBulkIndexer ¶
func (c *Client) NewBulkIndexer(orgs []domain.OrganizationConfig, workers int) (esutil.BulkIndexer, error)
func (*Client) NewOAIPMHStore ¶
func (c *Client) NewOAIPMHStore() (*OAIPMHStore, error)
func (*Client) NewSitemapStore ¶
func (c *Client) NewSitemapStore() *SitemapStore
type Config ¶
type Config struct { // urls to connect to elasticsearch cluster Urls []string `json:"urls"` // UserName is the BasicAuth username UserName string `json:"userName"` // Password is the BasicAuth password Password string `json:"password"` // Logger messages generated by the Client Logger *zerolog.Logger // Retries are maximum number of http retries MaxRetries int // Timeout is de max time in seconds before the request times out Timeout int // DisableMetrics disables publishing metrics to expvar DisableMetrics bool }
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig is the default configuration. It can be used to only modify your changes such as Urls or use as basis for an external config.
Default logger is a Nop.
type Debug ¶
type Debug struct{}
func (Debug) SearchService ¶
SearchService returns the search source (json send to elasticsearch) as JSON []byte
type ErrorType ¶
type ErrorType struct { Index string Type string Reason string CauseType string CauseReason string }
func GetErrorType ¶
type IndexNames ¶
type IndexNames struct{}
func (IndexNames) FragmentIndexName ¶
func (in IndexNames) FragmentIndexName(orgID string) string
func (IndexNames) GetDigitalObjectIndexName ¶
func (in IndexNames) GetDigitalObjectIndexName(orgID, suffix string) string
func (IndexNames) GetIndexName ¶
func (in IndexNames) GetIndexName(orgID string) string
GetIndexName returns the lowercased indexname. This inforced correct behavior when creating an index in ElasticSearch.
func (IndexNames) GetSuggestIndexName ¶
func (in IndexNames) GetSuggestIndexName(orgID string) string
func (IndexNames) GetV1IndexName ¶
func (in IndexNames) GetV1IndexName(orgID string) string
type Indices ¶
type Indices struct {
// contains filtered or unexported fields
}
func (*Indices) Create ¶
IndexCreate creates a new index with the supplied mapping.
The internal index created from the alias and a timestamp. If 'force' is false, no index is created when the alias exists. When it does not exist a new index is created and the alias is set.
When force is true, there is no check for the alias and no alias is set for created index.
type OAIPMHStore ¶
type OAIPMHStore struct { ResponseSize int // contains filtered or unexported fields }
func (*OAIPMHStore) GetRecord ¶
func (o *OAIPMHStore) GetRecord(ctx context.Context, q *oaipmh.RequestConfig) (record oaipmh.Record, errors []oaipmh.Error, err error)
func (*OAIPMHStore) ListIdentifiers ¶
func (o *OAIPMHStore) ListIdentifiers(ctx context.Context, q *oaipmh.RequestConfig) (res oaipmh.Resumable, err error)
func (*OAIPMHStore) ListMetadataFormats ¶
func (o *OAIPMHStore) ListMetadataFormats(ctx context.Context, q *oaipmh.RequestConfig) (formats []oaipmh.MetadataFormat, err error)
func (*OAIPMHStore) ListRecords ¶
func (o *OAIPMHStore) ListRecords(ctx context.Context, q *oaipmh.RequestConfig) (res oaipmh.Resumable, err error)
func (*OAIPMHStore) ListSets ¶
func (o *OAIPMHStore) ListSets(ctx context.Context, q *oaipmh.RequestConfig) (res oaipmh.Resumable, err error)
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
func NewQueryBuilder ¶
func NewQueryBuilder(defaultFields ...QueryField) *QueryBuilder
func (*QueryBuilder) NewElasticQuery ¶
func (qb *QueryBuilder) NewElasticQuery(q *search.QueryTerm) elastic.Query
type QueryField ¶
type Response ¶
type Response = externalAPI.Response
type SitemapStore ¶
type SitemapStore struct {
// contains filtered or unexported fields
}
func (*SitemapStore) LocationCount ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package elasticsearchtests provides docker based integration-tests for the elasticsearch driver package.
|
Package elasticsearchtests provides docker based integration-tests for the elasticsearch driver package. |