Documentation ¶
Overview ¶
Creates or updates a document in an index.
Index ¶
- Variables
- type Index
- func (r Index) Do(providedCtx context.Context) (*Response, error)
- func (r *Index) Document(document interface{}) *Index
- func (r *Index) Header(key, value string) *Index
- func (r *Index) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *Index) Id(id string) *Index
- func (r *Index) IfPrimaryTerm(ifprimaryterm string) *Index
- func (r *Index) IfSeqNo(sequencenumber string) *Index
- func (r *Index) OpType(optype optype.OpType) *Index
- func (r Index) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *Index) Pipeline(pipeline string) *Index
- func (r *Index) Raw(raw io.Reader) *Index
- func (r *Index) Refresh(refresh refresh.Refresh) *Index
- func (r *Index) Request(req interface{}) *Index
- func (r *Index) RequireAlias(requirealias bool) *Index
- func (r *Index) Routing(routing string) *Index
- func (r *Index) Timeout(duration string) *Index
- func (r *Index) Version(versionnumber string) *Index
- func (r *Index) VersionType(versiontype versiontype.VersionType) *Index
- func (r *Index) WaitForActiveShards(waitforactiveshards string) *Index
- type NewIndex
- 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 Index ¶
type Index struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *Index
Creates or updates a document in an index.
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
func (Index) Do ¶
Do runs the request through the transport, handle the response and returns a index.Response
func (*Index) Document ¶ added in v8.9.0
Document allows to set the request property with the appropriate payload.
func (*Index) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*Index) IfPrimaryTerm ¶
IfPrimaryTerm Only perform the operation if the document has this primary term. API name: if_primary_term
func (*Index) IfSeqNo ¶
IfSeqNo Only perform the operation if the document has this sequence number. API name: if_seq_no
func (*Index) OpType ¶
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
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*Index) Pipeline ¶
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 ¶
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 ¶
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) RequireAlias ¶
RequireAlias If `true`, the destination must be an index alias. API name: require_alias
func (*Index) Routing ¶
Routing Custom value used to route operations to a specific shard. API name: routing
func (*Index) Timeout ¶
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 ¶
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 ¶
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 ¶
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
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