Documentation
¶
Index ¶
- type AggregationResponse
- type BoolQuery
- type BoolQueryType
- type BulkIndexResponse
- type BulkResponse
- type BulkResponseItem
- type ElasticsearchClient
- type Hit
- type Hits
- type MatchQuery
- type MultiSearchResponse
- type NestedQuery
- type Order
- type Query
- type RangeQuery
- type SearchBody
- type SearchResponse
- type SearchResponseError
- type TermQuery
- type Terms
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregationResponse ¶
type AggregationResponse struct { Buckets []struct { Key string `json:"key"` } `json:"buckets"` }
AggregationResponse defines aggregation response.
type BoolQuery ¶
type BoolQuery struct { Term map[string]string `json:"term,omitempty"` Regexp map[string]TermQuery `json:"regexp,omitempty"` Nested *NestedQuery `json:"nested,omitempty"` BoolQuery map[BoolQueryType][]BoolQuery `json:"bool,omitempty"` RangeQueries map[string]RangeQuery `json:"range,omitempty"` MatchQueries map[string]MatchQuery `json:"match,omitempty"` }
BoolQuery defines bool query.
type BoolQueryType ¶
type BoolQueryType string
BoolQueryType defines bool query type.
const Must BoolQueryType = "must"
Must defines must bool query type.
const Should BoolQueryType = "should"
Should defines should bool query type.
type BulkIndexResponse ¶
type BulkIndexResponse struct { ID string `json:"_id"` Result string `json:"result"` Status int `json:"status"` Error struct { Type string `json:"type"` Reason string `json:"reason"` Cause struct { Type string `json:"type"` Reason string `json:"reason"` } `json:"caused_by"` } `json:"error"` }
BulkIndexResponse is a bulk response for index action
type BulkResponse ¶
type BulkResponse struct { Errors bool `json:"errors"` Items []BulkResponseItem `json:"items"` }
BulkResponse is a response returned by Elasticsearch Bulk API
type BulkResponseItem ¶
type BulkResponseItem struct {
Index BulkIndexResponse `json:"index"`
}
BulkResponseItem is a single response from BulkResponse
type ElasticsearchClient ¶
type ElasticsearchClient interface { // PutTemplate creates index template PutTemplate(ctx context.Context, name string, template io.Reader) error // Bulk submits a bulk request Bulk(ctx context.Context, bulkBody io.Reader) (*BulkResponse, error) // AddDataToBulkBuffer creates bulk item from data, index and typ and adds it to bulkBody AddDataToBulkBuffer(bulkBody *bytes.Buffer, data []byte, index, typ string) // Index indexes data into storage Index(ctx context.Context, body io.Reader, index, typ string) error // Search searches data via /_search Search(ctx context.Context, query SearchBody, size int, indices ...string) (*SearchResponse, error) // MultiSearch searches data via /_msearch MultiSearch(ctx context.Context, queries []SearchBody) (*MultiSearchResponse, error) // Major version returns major ES version MajorVersion() int }
ElasticsearchClient exposes Elasticsearch API used by Jaeger. This is not a general purpose ES client implementation. The exposed APIs are the bare minimum that is used by Jaeger project to store and query data.
func NewElasticsearchClient ¶
func NewElasticsearchClient(params config.Configuration, logger *zap.Logger) (ElasticsearchClient, error)
NewElasticsearchClient returns an instance of Elasticsearch client
type Hit ¶
type Hit struct {
Source *json.RawMessage `json:"_source"`
}
Hit defines a single search hit.
type MatchQuery ¶
type MatchQuery struct {
Query string `json:"query"`
}
MatchQuery defines match query.
type MultiSearchResponse ¶
type MultiSearchResponse struct {
Responses []SearchResponse `json:"responses"`
}
MultiSearchResponse defines multi search response.
type NestedQuery ¶
NestedQuery defines nested query.
type Order ¶
type Order string
Order defines order in the query.
const ( // AscOrder defines ascending order. AscOrder Order = "asc" )
type Query ¶
type Query struct { Term *Terms `json:"term,omitempty"` RangeQueries map[string]RangeQuery `json:"range,omitempty"` BoolQuery map[BoolQueryType][]BoolQuery `json:"bool,omitempty"` }
Query defines search query.
type RangeQuery ¶
type RangeQuery struct { GTE interface{} `json:"gte"` LTE interface{} `json:"lte"` }
RangeQuery defines range query.
type SearchBody ¶
type SearchBody struct { // indices are not in body, the ES client puts them to request path Indices []string `json:"-"` Aggregations json.RawMessage `json:"aggs,omitempty"` Query *Query `json:"query,omitempty"` Sort []map[string]Order `json:"sort,omitempty"` Size int `json:"size"` TerminateAfter int `json:"terminate_after"` SearchAfter []interface{} `json:"search_after,omitempty"` }
SearchBody defines search request.
type SearchResponse ¶
type SearchResponse struct { Hits Hits `json:"hits"` Aggs map[string]AggregationResponse `json:"aggregations,omitempty"` Error *SearchResponseError `json:"error,omitempty"` }
SearchResponse defines search response.
type SearchResponseError ¶
type SearchResponseError struct {
json.RawMessage
}
SearchResponseError defines search response error.
func (*SearchResponseError) String ¶
func (e *SearchResponseError) String() string