index

package
v8.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 16 Imported by: 7

Documentation

Overview

Creates or updates a document in an index.

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 Index

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

func (Index) Do

func (r Index) Do(providedCtx context.Context) (*Response, error)

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

func (*Index) Document added in v8.9.0

func (r *Index) Document(document interface{}) *Index

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

func (*Index) Header

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

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

func (*Index) HttpRequest

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

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

func (*Index) Id

func (r *Index) Id(id string) *Index

Id Unique identifier for the document. API Name: id

func (*Index) IfPrimaryTerm

func (r *Index) IfPrimaryTerm(ifprimaryterm string) *Index

IfPrimaryTerm Only perform the operation if the document has this primary term. API name: if_primary_term

func (*Index) IfSeqNo

func (r *Index) IfSeqNo(sequencenumber string) *Index

IfSeqNo Only perform the operation if the document has this sequence number. API name: if_seq_no

func (*Index) OpType

func (r *Index) OpType(optype optype.OpType) *Index

OpType Set to create to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. Same as using the `<index>/_create` endpoint. Valid values: `index`, `create`. If document id is specified, it defaults to `index`. Otherwise, it defaults to `create`. API name: op_type

func (Index) Perform added in v8.7.0

func (r Index) Perform(providedCtx context.Context) (*http.Response, error)

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

func (*Index) Pipeline

func (r *Index) Pipeline(pipeline string) *Index

Pipeline ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. API name: pipeline

func (*Index) Raw

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

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

func (*Index) Refresh

func (r *Index) Refresh(refresh refresh.Refresh) *Index

Refresh If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. API name: refresh

func (*Index) Request

func (r *Index) Request(req interface{}) *Index

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

func (*Index) RequireAlias

func (r *Index) RequireAlias(requirealias bool) *Index

RequireAlias If `true`, the destination must be an index alias. API name: require_alias

func (*Index) Routing

func (r *Index) Routing(routing string) *Index

Routing Custom value used to route operations to a specific shard. API name: routing

func (*Index) Timeout

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

Timeout Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. API name: timeout

func (*Index) Version

func (r *Index) Version(versionnumber string) *Index

Version Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. API name: version

func (*Index) VersionType

func (r *Index) VersionType(versiontype versiontype.VersionType) *Index

VersionType Specific version type: `external`, `external_gte`. API name: version_type

func (*Index) WaitForActiveShards

func (r *Index) WaitForActiveShards(waitforactiveshards string) *Index

WaitForActiveShards The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). API name: wait_for_active_shards

type NewIndex

type NewIndex func(index string) *Index

NewIndex type alias for index.

func NewIndexFunc

func NewIndexFunc(tp elastictransport.Interface) NewIndex

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

type Request added in v8.11.0

type Request = json.RawMessage

Request holds the request body struct for the package index

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/index/IndexRequest.ts#L35-L117

func NewRequest added in v8.13.1

func NewRequest() *Request

NewRequest returns a Request

type Response added in v8.7.0

type Response struct {
	ForcedRefresh *bool                 `json:"forced_refresh,omitempty"`
	Id_           string                `json:"_id"`
	Index_        string                `json:"_index"`
	PrimaryTerm_  int64                 `json:"_primary_term"`
	Result        result.Result         `json:"result"`
	SeqNo_        int64                 `json:"_seq_no"`
	Shards_       types.ShardStatistics `json:"_shards"`
	Version_      int64                 `json:"_version"`
}

Response holds the response body struct for the package index

https://github.com/elastic/elasticsearch-specification/blob/5bf86339cd4bda77d07f6eaa6789b72f9c0279b1/specification/_global/index/IndexResponse.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