Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetailedError ¶ added in v1.55.0
DetailedError creates a more detailed error if the error stack contains elastic.Error. This is useful because by default olivere/elastic returns errors that print like this:
elastic: Error 400 (Bad Request): all shards failed [type=search_phase_execution_exception]
This is pretty useless because it masks the underlying root cause. DetailedError would instead return an error like this:
<same as above>: RootCause[... detailed error message ...]
Types ¶
type Client ¶
type Client interface { IndexExists(index string) IndicesExistsService CreateIndex(index string) IndicesCreateService CreateTemplate(id string) TemplateCreateService Index() IndexService Search(indices ...string) SearchService MultiSearch() MultiSearchService io.Closer GetVersion() uint }
Client is an abstraction for elastic.Client
type IndexService ¶
type IndexService interface { Index(index string) IndexService Type(typ string) IndexService Id(id string) IndexService BodyJson(body interface{}) IndexService Add() }
IndexService is an abstraction for elastic BulkService
type IndicesCreateService ¶
type IndicesCreateService interface { Body(mapping string) IndicesCreateService Do(ctx context.Context) (*elastic.IndicesCreateResult, error) }
IndicesCreateService is an abstraction for elastic.IndicesCreateService
type IndicesExistsService ¶
IndicesExistsService is an abstraction for elastic.IndicesExistsService
type MultiSearchService ¶ added in v0.6.0
type MultiSearchService interface { Add(requests ...*elastic.SearchRequest) MultiSearchService Index(indices ...string) MultiSearchService Do(ctx context.Context) (*elastic.MultiSearchResult, error) }
MultiSearchService is an abstraction for elastic.MultiSearchService
type SearchService ¶
type SearchService interface { Size(size int) SearchService Aggregation(name string, aggregation elastic.Aggregation) SearchService Query(query elastic.Query) SearchService Do(ctx context.Context) (*elastic.SearchResult, error) }
SearchService is an abstraction for elastic.SearchService
type TemplateApplier ¶ added in v1.22.0
TemplateApplier applies a parsed template to input data that maps to the template's variables.
type TemplateBuilder ¶ added in v1.22.0
type TemplateBuilder interface {
Parse(text string) (TemplateApplier, error)
}
TemplateBuilder parses a given string and returns TemplateApplier TemplateBuilder is an abstraction to support mocking template/text
type TemplateCreateService ¶ added in v1.14.0
type TemplateCreateService interface { Body(mapping string) TemplateCreateService Do(ctx context.Context) (*elastic.IndicesPutTemplateResponse, error) }
TemplateCreateService is an abstraction for creating a mapping
type TextTemplateBuilder ¶ added in v1.22.0
type TextTemplateBuilder struct{}
TextTemplateBuilder implements TemplateBuilder
func (TextTemplateBuilder) Parse ¶ added in v1.22.0
func (t TextTemplateBuilder) Parse(tmpl string) (TemplateApplier, error)
Parse is a wrapper for template.Parse