Documentation
¶
Index ¶
- type API
- func (api *API) CallElastic(ctx context.Context, path, method string, payload interface{}) ([]byte, int, error)
- func (api *API) DeleteSearchIndex(ctx context.Context, instanceID, dimension string) (int, error)
- func (api *API) QuerySearchIndex(ctx context.Context, instanceID, dimension, term string, limit, offset int) (*models.SearchResponse, int, error)
- type Body
- type Bool
- type Highlight
- type Match
- type Object
- type Query
- type Score
- type Scores
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶ added in v1.8.0
type API struct {
// contains filtered or unexported fields
}
API aggregates a client and URL and other common data for accessing the API
func NewElasticSearchAPI ¶ added in v1.8.0
func NewElasticSearchAPI(client rchttp.Clienter, elasticSearchAPIURL string, signRequests bool) *API
NewElasticSearchAPI creates an API object
func (*API) CallElastic ¶ added in v1.8.0
func (api *API) CallElastic(ctx context.Context, path, method string, payload interface{}) ([]byte, int, error)
CallElastic builds a request to elastic search based on the method, path and payload
func (*API) DeleteSearchIndex ¶ added in v1.8.0
DeleteSearchIndex removes an index from elasticsearch
type Body ¶ added in v1.8.0
type Body struct {
From int `json:"from"`
Size int `json:"size"`
Highlight *Highlight `json:"highlight,omitempty"`
Query Query `json:"query"`
Sort []Scores `json:"sort"`
}
Body represents the request body to elasticsearch
type Highlight ¶ added in v1.8.0
type Highlight struct {
PreTags []string `json:"pre_tags,omitempty"`
PostTags []string `json:"post_tags,omitempty"`
Fields map[string]Object `json:"fields,omitempty"`
Order string `json:"score,omitempty"`
}
Highlight represents parts of the fields that matched
type Match ¶ added in v1.8.0
Match represents the fields that the term should or must match within query
type Object ¶ added in v1.8.0
type Object struct{}
Object represents an empty object (as expected by elasticsearch)
type Query ¶ added in v1.8.0
type Query struct {
Bool Bool `json:"bool"`
}
Query represents the request query details
Click to show internal directories.
Click to hide internal directories.