Documentation
¶
Index ¶
- Variables
- func InitializeContext(ctx context.Context) context.Context
- type ClientFunctions
- type ClientService
- func (c ClientService) Index(ctx context.Context, client *elasticsearch.Client, index, data string) (*esapi.Response, error)
- func (c ClientService) IndexerAdd(ctx context.Context, indexer esutil.BulkIndexer, document *IndexedDocument, ...) error
- func (c ClientService) IndexerClose(ctx context.Context, indexer esutil.BulkIndexer) error
- func (c ClientService) IndexerStats(indexer esutil.BulkIndexer) esutil.BulkIndexerStats
- func (c ClientService) NewBulkIndexer(client *elasticsearch.Client) (esutil.BulkIndexer, error)
- func (c ClientService) NewClient(config elasticsearch.Config) (*elasticsearch.Client, error)
- func (c ClientService) ResBodyClose(res *esapi.Response)
- func (c ClientService) ResBodyDecode(res *esapi.Response, v interface{}) error
- func (c ClientService) ResIsError(res *esapi.Response) bool
- func (c ClientService) Search(ctx context.Context, client *elasticsearch.Client, index string, body string) (*esapi.Response, error)
- type ClientServiceFuncMock
- func (c ClientServiceFuncMock) Index(ctx context.Context, client *elasticsearch.Client, index, data string) (*esapi.Response, error)
- func (c ClientServiceFuncMock) IndexerAdd(ctx context.Context, indexer esutil.BulkIndexer, document *IndexedDocument, ...) error
- func (c ClientServiceFuncMock) IndexerClose(ctx context.Context, indexer esutil.BulkIndexer) error
- func (c ClientServiceFuncMock) IndexerStats(indexer esutil.BulkIndexer) esutil.BulkIndexerStats
- func (c ClientServiceFuncMock) NewBulkIndexer(client *elasticsearch.Client) (esutil.BulkIndexer, error)
- func (c ClientServiceFuncMock) NewClient(config elasticsearch.Config) (*elasticsearch.Client, error)
- func (c ClientServiceFuncMock) ResBodyClose(res *esapi.Response)
- func (c ClientServiceFuncMock) ResBodyDecode(res *esapi.Response, v interface{}) error
- func (c ClientServiceFuncMock) ResIsError(res *esapi.Response) bool
- func (c ClientServiceFuncMock) Search(ctx context.Context, client *elasticsearch.Client, index string, body string) (*esapi.Response, error)
- 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 ¶
Functions ¶
Types ¶
type ClientFunctions ¶ added in v0.16.0
type ClientFunctions interface {
NewClient(
config elasticsearch.Config,
) (*elasticsearch.Client, error)
Index(
ctx context.Context,
client *elasticsearch.Client,
index, data string,
) (*esapi.Response, error)
Search(
ctx context.Context,
client *elasticsearch.Client,
index string,
body string,
) (*esapi.Response, error)
ResBodyClose(res *esapi.Response)
ResIsError(res *esapi.Response) bool
ResBodyDecode(res *esapi.Response, v interface{}) error
NewBulkIndexer(
client *elasticsearch.Client,
) (esutil.BulkIndexer, error)
IndexerAdd(ctx context.Context,
indexer esutil.BulkIndexer,
document *IndexedDocument,
correlator string,
) error
IndexerClose(ctx context.Context, indexer esutil.BulkIndexer) error
IndexerStats(indexer esutil.BulkIndexer) esutil.BulkIndexerStats
}
type ClientService ¶ added in v0.16.0
type ClientService struct{}
func NewElasticsearchClientService ¶ added in v0.16.0
func NewElasticsearchClientService() *ClientService
func (ClientService) Index ¶ added in v0.16.0
func (c ClientService) Index( ctx context.Context, client *elasticsearch.Client, index, data string, ) (*esapi.Response, error)
func (ClientService) IndexerAdd ¶ added in v0.16.0
func (c ClientService) IndexerAdd( ctx context.Context, indexer esutil.BulkIndexer, document *IndexedDocument, correlator string, ) error
func (ClientService) IndexerClose ¶ added in v0.16.0
func (c ClientService) IndexerClose(ctx context.Context, indexer esutil.BulkIndexer) error
func (ClientService) IndexerStats ¶ added in v0.16.0
func (c ClientService) IndexerStats(indexer esutil.BulkIndexer) esutil.BulkIndexerStats
func (ClientService) NewBulkIndexer ¶ added in v0.16.0
func (c ClientService) NewBulkIndexer( client *elasticsearch.Client, ) (esutil.BulkIndexer, error)
func (ClientService) NewClient ¶ added in v0.16.0
func (c ClientService) NewClient( config elasticsearch.Config, ) (*elasticsearch.Client, error)
func (ClientService) ResBodyClose ¶ added in v0.16.0
func (c ClientService) ResBodyClose(res *esapi.Response)
func (ClientService) ResBodyDecode ¶ added in v0.16.0
func (c ClientService) ResBodyDecode(res *esapi.Response, v interface{}) error
func (ClientService) ResIsError ¶ added in v0.16.0
func (c ClientService) ResIsError(res *esapi.Response) bool
type ClientServiceFuncMock ¶ added in v0.16.0
type ClientServiceFuncMock struct{}
func (ClientServiceFuncMock) Index ¶ added in v0.16.0
func (c ClientServiceFuncMock) Index( ctx context.Context, client *elasticsearch.Client, index, data string, ) (*esapi.Response, error)
func (ClientServiceFuncMock) IndexerAdd ¶ added in v0.16.0
func (c ClientServiceFuncMock) IndexerAdd( ctx context.Context, indexer esutil.BulkIndexer, document *IndexedDocument, correlator string, ) error
func (ClientServiceFuncMock) IndexerClose ¶ added in v0.16.0
func (c ClientServiceFuncMock) IndexerClose( ctx context.Context, indexer esutil.BulkIndexer, ) error
func (ClientServiceFuncMock) IndexerStats ¶ added in v0.16.0
func (c ClientServiceFuncMock) IndexerStats(indexer esutil.BulkIndexer) esutil.BulkIndexerStats
func (ClientServiceFuncMock) NewBulkIndexer ¶ added in v0.16.0
func (c ClientServiceFuncMock) NewBulkIndexer( client *elasticsearch.Client, ) (esutil.BulkIndexer, error)
func (ClientServiceFuncMock) NewClient ¶ added in v0.16.0
func (c ClientServiceFuncMock) NewClient( config elasticsearch.Config, ) (*elasticsearch.Client, error)
func (ClientServiceFuncMock) ResBodyClose ¶ added in v0.16.0
func (c ClientServiceFuncMock) ResBodyClose(res *esapi.Response)
func (ClientServiceFuncMock) ResBodyDecode ¶ added in v0.16.0
func (c ClientServiceFuncMock) ResBodyDecode(res *esapi.Response, v interface{}) error
func (ClientServiceFuncMock) ResIsError ¶ added in v0.16.0
func (c ClientServiceFuncMock) ResIsError(res *esapi.Response) bool
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 ¶
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 (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
ESServiceClient ClientFunctions
// 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.