Documentation ¶
Overview ¶
Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices.
Index ¶
- Variables
- type NewPutTemplate
- type PutTemplate
- func (r *PutTemplate) Aliases(aliases map[string]types.Alias) *PutTemplate
- func (r *PutTemplate) Cause(cause string) *PutTemplate
- func (r *PutTemplate) Create(create bool) *PutTemplate
- func (r PutTemplate) Do(providedCtx context.Context) (*Response, error)
- func (r *PutTemplate) ErrorTrace(errortrace bool) *PutTemplate
- func (r *PutTemplate) FilterPath(filterpaths ...string) *PutTemplate
- func (r *PutTemplate) Header(key, value string) *PutTemplate
- func (r *PutTemplate) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *PutTemplate) Human(human bool) *PutTemplate
- func (r *PutTemplate) IndexPatterns(indexpatterns ...string) *PutTemplate
- func (r *PutTemplate) Mappings(mappings *types.TypeMapping) *PutTemplate
- func (r *PutTemplate) MasterTimeout(duration string) *PutTemplate
- func (r *PutTemplate) Order(order int) *PutTemplate
- func (r PutTemplate) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *PutTemplate) Pretty(pretty bool) *PutTemplate
- func (r *PutTemplate) Raw(raw io.Reader) *PutTemplate
- func (r *PutTemplate) Request(req *Request) *PutTemplate
- func (r *PutTemplate) Settings(settings *types.IndexSettings) *PutTemplate
- func (r *PutTemplate) Version(versionnumber int64) *PutTemplate
- type Request
- type Response
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 ¶
type NewPutTemplate ¶
type NewPutTemplate func(name string) *PutTemplate
NewPutTemplate type alias for index.
func NewPutTemplateFunc ¶
func NewPutTemplateFunc(tp elastictransport.Interface) NewPutTemplate
NewPutTemplateFunc returns a new instance of PutTemplate with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.
type PutTemplate ¶
type PutTemplate struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *PutTemplate
Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices.
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html
func (*PutTemplate) Aliases ¶ added in v8.9.0
func (r *PutTemplate) Aliases(aliases map[string]types.Alias) *PutTemplate
Aliases Aliases for the index. API name: aliases
func (*PutTemplate) Cause ¶ added in v8.14.0
func (r *PutTemplate) Cause(cause string) *PutTemplate
API name: cause
func (*PutTemplate) Create ¶
func (r *PutTemplate) Create(create bool) *PutTemplate
Create If true, this request cannot replace or update existing index templates. API name: create
func (PutTemplate) Do ¶
func (r PutTemplate) Do(providedCtx context.Context) (*Response, error)
Do runs the request through the transport, handle the response and returns a puttemplate.Response
func (*PutTemplate) ErrorTrace ¶ added in v8.14.0
func (r *PutTemplate) ErrorTrace(errortrace bool) *PutTemplate
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace
func (*PutTemplate) FilterPath ¶ added in v8.14.0
func (r *PutTemplate) FilterPath(filterpaths ...string) *PutTemplate
FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path
func (*PutTemplate) Header ¶
func (r *PutTemplate) Header(key, value string) *PutTemplate
Header set a key, value pair in the PutTemplate headers map.
func (*PutTemplate) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*PutTemplate) Human ¶ added in v8.14.0
func (r *PutTemplate) Human(human bool) *PutTemplate
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 human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human
func (*PutTemplate) IndexPatterns ¶ added in v8.9.0
func (r *PutTemplate) IndexPatterns(indexpatterns ...string) *PutTemplate
IndexPatterns Array of wildcard expressions used to match the names of indices during creation. API name: index_patterns
func (*PutTemplate) Mappings ¶ added in v8.9.0
func (r *PutTemplate) Mappings(mappings *types.TypeMapping) *PutTemplate
Mappings Mapping for fields in the index. API name: mappings
func (*PutTemplate) MasterTimeout ¶
func (r *PutTemplate) MasterTimeout(duration string) *PutTemplate
MasterTimeout Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. API name: master_timeout
func (*PutTemplate) Order ¶
func (r *PutTemplate) Order(order int) *PutTemplate
Order Order in which Elasticsearch applies this template if index matches multiple templates.
Templates with lower 'order' values are merged first. Templates with higher 'order' values are merged later, overriding templates with lower values. API name: order
func (PutTemplate) Perform ¶ added in v8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*PutTemplate) Pretty ¶ added in v8.14.0
func (r *PutTemplate) Pretty(pretty bool) *PutTemplate
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty
func (*PutTemplate) Raw ¶
func (r *PutTemplate) Raw(raw io.Reader) *PutTemplate
Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.
func (*PutTemplate) Request ¶
func (r *PutTemplate) Request(req *Request) *PutTemplate
Request allows to set the request property with the appropriate payload.
func (*PutTemplate) Settings ¶ added in v8.9.0
func (r *PutTemplate) Settings(settings *types.IndexSettings) *PutTemplate
Settings Configuration options for the index. API name: settings
func (*PutTemplate) Version ¶ added in v8.9.0
func (r *PutTemplate) Version(versionnumber int64) *PutTemplate
Version Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. API name: version
type Request ¶
type Request struct { // Aliases Aliases for the index. Aliases map[string]types.Alias `json:"aliases,omitempty"` // IndexPatterns Array of wildcard expressions used to match the names // of indices during creation. IndexPatterns []string `json:"index_patterns,omitempty"` // Mappings Mapping for fields in the index. Mappings *types.TypeMapping `json:"mappings,omitempty"` // Order Order in which Elasticsearch applies this template if index // matches multiple templates. // // Templates with lower 'order' values are merged first. Templates with higher // 'order' values are merged later, overriding templates with lower values. Order *int `json:"order,omitempty"` // Settings Configuration options for the index. Settings *types.IndexSettings `json:"settings,omitempty"` // Version Version number used to manage index templates externally. This number // is not automatically generated by Elasticsearch. Version *int64 `json:"version,omitempty"` }
Request holds the request body struct for the package puttemplate
func (*Request) FromJSON ¶ added in v8.5.0
FromJSON allows to load an arbitrary json into the request structure