translate
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Translate SQL into Elasticsearch queries.Translate an SQL search into a search API request containing Query DSL.It accepts the same request body parameters as the SQL search API, excluding`cursor`.
Index¶
- Variables
- type NewTranslate
- type Request
- type Response
- type Translate
- func (r Translate) Do(providedCtx context.Context) (*Response, error)
- func (r *Translate) ErrorTrace(errortrace bool) *Translate
- func (r *Translate) FetchSize(fetchsize int) *Translate
- func (r *Translate) Filter(filter *types.Query) *Translate
- func (r *Translate) FilterPath(filterpaths ...string) *Translate
- func (r *Translate) Header(key, value string) *Translate
- func (r *Translate) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Translate) Human(human bool) *Translate
- func (r Translate) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *Translate) Pretty(pretty bool) *Translate
- func (r *Translate) Query(query string) *Translate
- func (r *Translate) Raw(raw io.Reader) *Translate
- func (r *Translate) Request(req *Request) *Translate
- func (r *Translate) TimeZone(timezone string) *Translate
Constants¶
This section is empty.
Variables¶
var ErrBuildPath =errors.New("cannot build path, check for missing path parameters")ErrBuildPath is returned in case of missing parameters within the build of the request.
Functions¶
This section is empty.
Types¶
typeNewTranslate¶
type NewTranslate func() *Translate
NewTranslate type alias for index.
funcNewTranslateFunc¶
func NewTranslateFunc(tpelastictransport.Interface)NewTranslate
NewTranslateFunc returns a new instance of Translate with the provided transport.Used in the index of the library this allows to retrieve every apis in once place.
typeRequest¶
type Request struct {// FetchSize The maximum number of rows (or entries) to return in one response.FetchSize *int `json:"fetch_size,omitempty"`// Filter The Elasticsearch query DSL for additional filtering.Filter *types.Query `json:"filter,omitempty"`// Query The SQL query to run.Querystring `json:"query"`// TimeZone The ISO-8601 time zone ID for the search.TimeZone *string `json:"time_zone,omitempty"`}Request holds the request body struct for the package translate
func (*Request)FromJSON¶added inv8.5.0
FromJSON allows to load an arbitrary json into the request structure
func (*Request)UnmarshalJSON¶added inv8.12.1
typeResponse¶added inv8.7.0
type Response struct {Aggregations map[string]types.Aggregations `json:"aggregations,omitempty"`Fields []types.FieldAndFormat `json:"fields,omitempty"`Query *types.Query `json:"query,omitempty"`Size *int64 `json:"size,omitempty"`Sort []types.SortCombinations `json:"sort,omitempty"`Source_types.SourceConfig `json:"_source,omitempty"`}Response holds the response body struct for the package translate
func (*Response)UnmarshalJSON¶added inv8.7.1
typeTranslate¶
type Translate struct {// contains filtered or unexported fields}funcNew¶
func New(tpelastictransport.Interface) *Translate
Translate SQL into Elasticsearch queries.Translate an SQL search into a search API request containing Query DSL.It accepts the same request body parameters as the SQL search API, excluding`cursor`.
https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate-api.html
func (Translate)Do¶
Do runs the request through the transport, handle the response and returns a translate.Response
func (*Translate)ErrorTrace¶added inv8.14.0
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errorswhen they occur.API name: error_trace
func (*Translate)FetchSize¶added inv8.9.0
FetchSize The maximum number of rows (or entries) to return in one response.API name: fetch_size
func (*Translate)Filter¶added inv8.9.0
Filter The Elasticsearch query DSL for additional filtering.API name: filter
func (*Translate)FilterPath¶added inv8.14.0
FilterPath Comma-separated list of filters in dot notation which reduce the responsereturned by Elasticsearch.API name: filter_path
func (*Translate)HttpRequest¶
HttpRequest returns the http.Request object built from thegiven parameters.
func (*Translate)Human¶added inv8.14.0
Human When set to `true` will return statistics in a format suitable for humans.For example `"exists_time": "1h"` for humans and`"eixsts_time_in_millis": 3600000` for computers. When disabled the humanreadable values will be omitted. This makes sense for responses beingconsumedonly by machines.API name: human
func (Translate)Perform¶added inv8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*Translate)Pretty¶added inv8.14.0
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only usethis option for debugging only.API name: pretty
func (*Translate)Raw¶
Raw takes a json payload as input which is then passed to the http.RequestIf specified Raw takes precedence on Request method.