putmapping

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Updates the index mappings.

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 NewPutMapping

type NewPutMapping func(index string) *PutMapping

NewPutMapping type alias for index.

func NewPutMappingFunc

func NewPutMappingFunc(tp elastictransport.Interface) NewPutMapping

NewPutMappingFunc returns a new instance of PutMapping with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.

type PutMapping

type PutMapping struct {
	// contains filtered or unexported fields
}

func (*PutMapping) AllowNoIndices

func (r *PutMapping) AllowNoIndices(b bool) *PutMapping

AllowNoIndices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) API name: allow_no_indices

func (PutMapping) Do

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

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

func (*PutMapping) ExpandWildcards

func (r *PutMapping) ExpandWildcards(v string) *PutMapping

ExpandWildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. API name: expand_wildcards

func (*PutMapping) Header

func (r *PutMapping) Header(key, value string) *PutMapping

Header set a key, value pair in the PutMapping headers map.

func (*PutMapping) HttpRequest

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

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

func (*PutMapping) IgnoreUnavailable

func (r *PutMapping) IgnoreUnavailable(b bool) *PutMapping

IgnoreUnavailable Whether specified concrete indices should be ignored when unavailable (missing or closed) API name: ignore_unavailable

func (*PutMapping) Index

func (r *PutMapping) Index(v string) *PutMapping

Index A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. API Name: index

func (*PutMapping) MasterTimeout

func (r *PutMapping) MasterTimeout(v string) *PutMapping

MasterTimeout Specify timeout for connection to master API name: master_timeout

func (PutMapping) Perform

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

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

func (*PutMapping) Raw

func (r *PutMapping) Raw(raw io.Reader) *PutMapping

Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.

func (*PutMapping) Request

func (r *PutMapping) Request(req *Request) *PutMapping

Request allows to set the request property with the appropriate payload.

func (*PutMapping) Timeout

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

Timeout Explicit operation timeout API name: timeout

func (*PutMapping) WriteIndexOnly

func (r *PutMapping) WriteIndexOnly(b bool) *PutMapping

WriteIndexOnly When true, applies mappings only to the write index of an alias or data stream API name: write_index_only

type Request

type Request struct {

	// DateDetection Controls whether dynamic date detection is enabled.
	DateDetection *bool `json:"date_detection,omitempty"`
	// Dynamic Controls whether new fields are added dynamically.
	Dynamic *dynamicmapping.DynamicMapping `json:"dynamic,omitempty"`
	// DynamicDateFormats If date detection is enabled then new string fields are checked
	// against 'dynamic_date_formats' and if the value matches then
	// a new date field is added instead of string.
	DynamicDateFormats []string `json:"dynamic_date_formats,omitempty"`
	// DynamicTemplates Specify dynamic templates for the mapping.
	DynamicTemplates []map[string]types.DynamicTemplate `json:"dynamic_templates,omitempty"`
	// FieldNames_ Control whether field names are enabled for the index.
	FieldNames_ *types.FieldNamesField `json:"_field_names,omitempty"`
	// Meta_ A mapping type can have custom meta data associated with it. These are
	// not used at all by Elasticsearch, but can be used to store
	// application-specific metadata.
	Meta_ map[string]json.RawMessage `json:"_meta,omitempty"`
	// NumericDetection Automatically map strings into numeric data types for all fields.
	NumericDetection *bool `json:"numeric_detection,omitempty"`
	// Properties Mapping for a field. For new fields, this mapping can include:
	//
	// - Field name
	// - Field data type
	// - Mapping parameters
	Properties map[string]types.Property `json:"properties,omitempty"`
	// Routing_ Enable making a routing value required on indexed documents.
	Routing_ *types.RoutingField `json:"_routing,omitempty"`
	// Runtime Mapping of runtime fields for the index.
	Runtime map[string]types.RuntimeField `json:"runtime,omitempty"`
	// Source_ Control whether the _source field is enabled on the index.
	Source_ *types.SourceField `json:"_source,omitempty"`
}

Request holds the request body struct for the package putmapping

https://github.com/elastic/elasticsearch-specification/blob/1ad7fe36297b3a8e187b2259dedaf68a47bc236e/specification/indices/put_mapping/IndicesPutMappingRequest.ts#L42-L116

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 {
	Shards_ *types.ShardStatistics `json:"_shards,omitempty"`
}

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