putmapping

package
v8.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: Apache-2.0 Imports: 14 Imported by: 4

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(allownoindices bool) *PutMapping

AllowNoIndices If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. API name: allow_no_indices

func (*PutMapping) DateDetection added in v8.9.0

func (r *PutMapping) DateDetection(datedetection bool) *PutMapping

DateDetection Controls whether dynamic date detection is enabled. API name: date_detection

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) Dynamic added in v8.9.0

func (r *PutMapping) Dynamic(dynamic dynamicmapping.DynamicMapping) *PutMapping

Dynamic Controls whether new fields are added dynamically. API name: dynamic

func (*PutMapping) DynamicDateFormats added in v8.9.0

func (r *PutMapping) DynamicDateFormats(dynamicdateformats ...string) *PutMapping

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. API name: dynamic_date_formats

func (*PutMapping) DynamicTemplates added in v8.9.0

func (r *PutMapping) DynamicTemplates(dynamictemplates []map[string]types.DynamicTemplate) *PutMapping

DynamicTemplates Specify dynamic templates for the mapping. API name: dynamic_templates

func (*PutMapping) ExpandWildcards

func (r *PutMapping) ExpandWildcards(expandwildcards ...expandwildcard.ExpandWildcard) *PutMapping

ExpandWildcards Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. API name: expand_wildcards

func (*PutMapping) FieldNames_ added in v8.9.0

func (r *PutMapping) FieldNames_(fieldnames_ *types.FieldNamesField) *PutMapping

FieldNames_ Control whether field names are enabled for the index. API name: _field_names

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(ignoreunavailable bool) *PutMapping

IgnoreUnavailable If `false`, the request returns an error if it targets a missing or closed index. API name: ignore_unavailable

func (*PutMapping) MasterTimeout

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

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 (*PutMapping) Meta_ added in v8.9.0

func (r *PutMapping) Meta_(metadata types.Metadata) *PutMapping

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. API name: _meta

func (*PutMapping) NumericDetection added in v8.9.0

func (r *PutMapping) NumericDetection(numericdetection bool) *PutMapping

NumericDetection Automatically map strings into numeric data types for all fields. API name: numeric_detection

func (PutMapping) Perform added in v8.7.0

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) Properties added in v8.9.0

func (r *PutMapping) Properties(properties map[string]types.Property) *PutMapping

Properties Mapping for a field. For new fields, this mapping can include:

- Field name - Field data type - Mapping parameters API name: properties

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) Routing_ added in v8.9.0

func (r *PutMapping) Routing_(routing_ *types.RoutingField) *PutMapping

Routing_ Enable making a routing value required on indexed documents. API name: _routing

func (*PutMapping) Runtime added in v8.9.0

func (r *PutMapping) Runtime(runtimefields types.RuntimeFields) *PutMapping

Runtime Mapping of runtime fields for the index. API name: runtime

func (*PutMapping) Source_ added in v8.9.0

func (r *PutMapping) Source_(source_ *types.SourceField) *PutMapping

Source_ Control whether the _source field is enabled on the index. API name: _source

func (*PutMapping) Timeout

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

Timeout Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. API name: timeout

func (*PutMapping) WriteIndexOnly

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

WriteIndexOnly If `true`, the mappings are applied only to the current write index for the target. 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_ types.Metadata `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 types.RuntimeFields `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/5fea44e006349579bf3561a82e997002e5716117/specification/indices/put_mapping/IndicesPutMappingRequest.ts#L42-L149

func NewRequest added in v8.5.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON added in v8.5.0

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

FromJSON allows to load an arbitrary json into the request structure

type Response added in v8.7.0

type Response struct {

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

Response holds the response body struct for the package putmapping

https://github.com/elastic/elasticsearch-specification/blob/5fea44e006349579bf3561a82e997002e5716117/specification/indices/put_mapping/IndicesPutMappingResponse.ts#L22-L24

func NewResponse added in v8.7.0

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