Documentation
¶
Index ¶
- func InitializeContext(ctx context.Context) context.Context
- type ContextKey
- type IndexedDocument
- type Logger
- type Response
- type ResponseError
- type Session
- func (s *Session) CleanUp(ctx context.Context)
- func (s *Session) ConfigureClient(ctx context.Context, config elasticsearch.Config) error
- func (s *Session) NewDocument(ctx context.Context, index string, props map[string]interface{}) error
- func (s *Session) SearchDocument(ctx context.Context, index string, body string) error
- func (s *Session) ValidateDocumentJSONProperties(ctx context.Context, props map[string]interface{}) error
- type Steps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey defines a type to store the elasticsearch session in context.Context.
type IndexedDocument ¶
IndexedDocument represents an Elasticsearch response of an index request with indexed document information
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger logs the elasticsearch requests and responses in a configurable file.
func GetLogger ¶
func GetLogger() *Logger
GetLogger returns the logger for elasticsearch requests and responses. If the logger is not created yet, it creates a new instance of Logger.
func NewLogger ¶
NewLogger creates an instance of the logger. It configures the file path where the elasticsearch requests and responses are written.
func (Logger) LogCreateIndex ¶
LogCreateIndex logs a creation in elasticsearch in the configured log file.
type Response ¶
type Response struct {
Error ResponseError `json:"error"`
}
Response represents the body of an elasticsearch response
type ResponseError ¶
ResponseError represents the error information in elasticsearch response
type Session ¶
type Session struct { Client *elasticsearch.Client SearchResult golium.Map Correlator string // contains filtered or unexported fields }
Session contains the information of a elasticsearch session.
func GetSession ¶
GetSession returns the elasticsearch session stored in context. Note that the context should be previously initialized with InitializeContext function.
func (*Session) ConfigureClient ¶
ConfigureClient creates a elasticsearch connection based on the URI.
func (*Session) NewDocument ¶
func (s *Session) NewDocument(ctx context.Context, index string, props map[string]interface{}) error
NewDocument creates a new document, with the given JSON and for the given index.
func (*Session) SearchDocument ¶
SearchDocument searches in elasticsearch with given index and JSON body and saves the result in the application context.
type Steps ¶
type Steps struct { }
Steps type is responsible to initialize the Elasticsearch client steps in godog framework.
func (Steps) InitializeSteps ¶
InitializeSteps adds client elasticsearch steps to the scenario context. It implements StepsInitializer interface. It returns a new context (context is immutable) with the elasticsearch Context.