puttemplate

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Creates or updates an index template.

Index

Constants

This section is empty.

Variables

View Source
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 (*PutTemplate) Create

func (r *PutTemplate) Create(b bool) *PutTemplate

Create If true, this request cannot replace or update existing index templates. API name: create

func (PutTemplate) Do

func (r PutTemplate) Do(ctx context.Context) (*Response, error)

Do runs the request through the transport, handle the response and returns a puttemplate.Response

func (*PutTemplate) FlatSettings

func (r *PutTemplate) FlatSettings(b bool) *PutTemplate

API name: flat_settings

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

func (r *PutTemplate) HttpRequest(ctx context.Context) (*http.Request, error)

HttpRequest returns the http.Request object built from the given parameters.

func (*PutTemplate) MasterTimeout

func (r *PutTemplate) MasterTimeout(v 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) Name

func (r *PutTemplate) Name(v string) *PutTemplate

Name The name of the template API Name: name

func (*PutTemplate) Order

func (r *PutTemplate) Order(i 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

func (r PutTemplate) Perform(ctx context.Context) (*http.Response, error)

Perform runs the http.Request through the provided transport and returns an http.Response.

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) Timeout

func (r *PutTemplate) Timeout(v string) *PutTemplate

API name: timeout

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 map[string]json.RawMessage `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

https://github.com/elastic/elasticsearch-specification/blob/1ad7fe36297b3a8e187b2259dedaf68a47bc236e/specification/indices/put_template/IndicesPutTemplateRequest.ts#L29-L93

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON

func (r *Request) FromJSON(data string) (*Request, error)

FromJSON allows to load an arbitrary json into the request structure

type Response

type Response struct {

	// Acknowledged For a successful response, this value is always true. On failure, an
	// exception is returned instead.
	Acknowledged bool `json:"acknowledged"`
}

func NewResponse

func NewResponse() *Response

NewResponse returns a Response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL