Documentation ¶
Overview ¶
Package elasticsteps provides steps for testing with elasticsearch using godog.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrIndexNotFound = errors.New("index not found")
ErrIndexNotFound indicates that the index is not found.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { IndexGetter IndexCreator IndexDeleter DocumentFinder DocumentIndexer DocumentDeleter }
Client is an interface for interacting with Elasticsearch.
type Document ¶
type Document struct { ID string `json:"_id"` Source json.RawMessage `json:"_source"` }
Document represents an Elasticsearch doc. nolint: tagliatelle
func (*Document) UnmarshalJSON ¶
UnmarshalJSON compacts document body while marshaling.
type DocumentDeleter ¶ added in v0.3.0
DocumentDeleter deletes documents.
type DocumentFinder ¶
type DocumentFinder interface {
FindDocuments(ctx context.Context, index string, query *string) ([]json.RawMessage, error)
}
DocumentFinder gets documents.
type DocumentIndexer ¶
type DocumentIndexer interface {
IndexDocuments(ctx context.Context, index string, documents ...Document) error
}
DocumentIndexer indexes documents.
type IndexCreator ¶
type IndexCreator interface { CreateIndex(ctx context.Context, index string, config *string) error RecreateIndex(ctx context.Context, index string, config *string) error }
IndexCreator creates indices.
type IndexDeleter ¶
IndexDeleter deletes indices.
type IndexGetter ¶
IndexGetter gets index.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the elasticsearch data.
func NewManager ¶
func NewManager(client Client, opts ...ManagerOption) *Manager
NewManager initiates a new data manager.
func (*Manager) RegisterContext ¶
func (m *Manager) RegisterContext(sc *godog.ScenarioContext)
RegisterContext registers the manager to the test suite.
type ManagerOption ¶
type ManagerOption func(m *Manager)
ManagerOption sets up the manager.
func WithInstance ¶
func WithInstance(name string, client Client) ManagerOption
WithInstance adds a new es instance.
type SearchResult ¶
type SearchResult struct {
Hits SearchResultHits
}
SearchResult represents the search result.
type SearchResultHits ¶
type SearchResultHits struct { Total SearchResultHitsTotal `json:"total"` MaxScore *float64 `json:"max_score"` Hits SearchResultHitsHits `json:"hits"` }
SearchResultHits represents the hits. nolint: tagliatelle
type SearchResultHitsHits ¶
type SearchResultHitsHits []json.RawMessage
SearchResultHitsHits represents the hits.hits.
func (*SearchResultHitsHits) UnmarshalJSON ¶
func (h *SearchResultHitsHits) UnmarshalJSON(data []byte) error
UnmarshalJSON removes unwanted fields.
type SearchResultHitsTotal ¶
SearchResultHitsTotal represents the hits.total.
Directories ¶
Path | Synopsis |
---|---|
driver
|
|
go-elasticsearch/v7
Package elasticsearch7 provides the client using go-elasticsearch driver.
|
Package elasticsearch7 provides the client using go-elasticsearch driver. |
features
|
|
bootstrap
Package bootstrap provides integration tests.
|
Package bootstrap provides integration tests. |