Movatterモバイル変換


[0]ホーム

URL:


Notice  The highest tagged major version isv9.

ingest

package
v8.19.1Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License:Apache-2.0Imports:12Imported by:0

Details

Repository

github.com/elastic/go-elasticsearch

Links

Documentation

Overview

Simulate data ingestion.Run ingest pipelines against a set of provided documents, optionally withsubstitute pipeline definitions, to simulate ingesting data into an index.

This API is meant to be used for troubleshooting or pipeline development, asit does not actually index any data into Elasticsearch.

The API runs the default and final pipeline for that index against a set ofdocuments provided in the body of the request.If a pipeline contains a reroute processor, it follows that reroute processorto the new index, running that index's pipelines as well the same way that anon-simulated ingest would.No data is indexed into Elasticsearch.Instead, the transformed document is returned, along with the list ofpipelines that have been run and the name of the index where the documentwould have been indexed if this were not a simulation.The transformed document is validated against the mappings that would applyto this index, and any validation error is reported in the result.

This API differs from the simulate pipeline API in that you specify a singlepipeline for that API, and it runs only that one pipeline.The simulate pipeline API is more useful for developing a single pipeline,while the simulate ingest API is more useful for troubleshooting theinteraction of the various pipelines that get applied when ingesting into anindex.

By default, the pipeline definitions that are currently in the system areused.However, you can supply substitute pipeline definitions in the body of therequest.These will be used in place of the pipeline definitions that are already inthe system. This can be used to replace existing pipeline definitions or tocreate new ones. The pipeline substitutions are used only within thisrequest.

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

typeIngest

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

funcNew

Simulate data ingestion.Run ingest pipelines against a set of provided documents, optionally withsubstitute pipeline definitions, to simulate ingesting data into an index.

This API is meant to be used for troubleshooting or pipeline development, asit does not actually index any data into Elasticsearch.

The API runs the default and final pipeline for that index against a set ofdocuments provided in the body of the request.If a pipeline contains a reroute processor, it follows that reroute processorto the new index, running that index's pipelines as well the same way that anon-simulated ingest would.No data is indexed into Elasticsearch.Instead, the transformed document is returned, along with the list ofpipelines that have been run and the name of the index where the documentwould have been indexed if this were not a simulation.The transformed document is validated against the mappings that would applyto this index, and any validation error is reported in the result.

This API differs from the simulate pipeline API in that you specify a singlepipeline for that API, and it runs only that one pipeline.The simulate pipeline API is more useful for developing a single pipeline,while the simulate ingest API is more useful for troubleshooting theinteraction of the various pipelines that get applied when ingesting into anindex.

By default, the pipeline definitions that are currently in the system areused.However, you can supply substitute pipeline definitions in the body of therequest.These will be used in place of the pipeline definitions that are already inthe system. This can be used to replace existing pipeline definitions or tocreate new ones. The pipeline substitutions are used only within thisrequest.

https://www.elastic.co/guide/en/elasticsearch/reference/current/simulate-ingest-api.html

func (*Ingest)ComponentTemplateSubstitutions

func (r *Ingest) ComponentTemplateSubstitutions(componenttemplatesubstitutions map[string]types.ComponentTemplateNode) *Ingest

ComponentTemplateSubstitutions A map of component template names to substitute component template definitionobjects.API name: component_template_substitutions

func (Ingest)Do

func (rIngest) Do(providedCtxcontext.Context) (*Response,error)

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

func (*Ingest)Docs

func (r *Ingest) Docs(docs ...types.Document) *Ingest

Docs Sample documents to test in the pipeline.API name: docs

func (*Ingest)ErrorTrace

func (r *Ingest) ErrorTrace(errortracebool) *Ingest

ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errorswhen they occur.API name: error_trace

func (*Ingest)FilterPath

func (r *Ingest) FilterPath(filterpaths ...string) *Ingest

FilterPath Comma-separated list of filters in dot notation which reduce the responsereturned by Elasticsearch.API name: filter_path

func (*Ingest)Header

func (r *Ingest) Header(key, valuestring) *Ingest

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

func (*Ingest)HttpRequest

func (r *Ingest) HttpRequest(ctxcontext.Context) (*http.Request,error)

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

func (*Ingest)Human

func (r *Ingest) Human(humanbool) *Ingest

Human When set to `true` will return statistics in a format suitable for humans.For example `"exists_time": "1h"` for humans and`"eixsts_time_in_millis": 3600000` for computers. When disabled the humanreadable values will be omitted. This makes sense for responses beingconsumedonly by machines.API name: human

func (*Ingest)Index

func (r *Ingest) Index(indexstring) *Ingest

Index The index to simulate ingesting into.This value can be overridden by specifying an index on each document.If you specify this parameter in the request path, it is used for anydocuments that do not explicitly specify an index argument.API Name: index

func (*Ingest)IndexTemplateSubstitutions

func (r *Ingest) IndexTemplateSubstitutions(indextemplatesubstitutions map[string]types.IndexTemplate) *Ingest

IndexTemplateSubstitutions A map of index template names to substitute index template definitionobjects.API name: index_template_substitutions

func (*Ingest)MappingAddition

func (r *Ingest) MappingAddition(mappingaddition *types.TypeMapping) *Ingest

API name: mapping_addition

func (Ingest)Perform

func (rIngest) Perform(providedCtxcontext.Context) (*http.Response,error)

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

func (*Ingest)Pipeline

func (r *Ingest) Pipeline(pipelinenamestring) *Ingest

Pipeline The pipeline to use as the default pipeline.This value can be used to override the default pipeline of the index.API name: pipeline

func (*Ingest)PipelineSubstitutions

func (r *Ingest) PipelineSubstitutions(pipelinesubstitutions map[string]types.IngestPipeline) *Ingest

PipelineSubstitutions Pipelines to test.If you don’t specify the `pipeline` request path parameter, this parameter isrequired.If you specify both this and the request path parameter, the API only usesthe request path parameter.API name: pipeline_substitutions

func (*Ingest)Pretty

func (r *Ingest) Pretty(prettybool) *Ingest

Pretty If set to `true` the returned JSON will be "pretty-formatted". Only usethis option for debugging only.API name: pretty

func (*Ingest)Raw

func (r *Ingest) Raw(rawio.Reader) *Ingest

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

func (*Ingest)Request

func (r *Ingest) Request(req *Request) *Ingest

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

typeNewIngest

type NewIngest func() *Ingest

NewIngest type alias for index.

funcNewIngestFunc

func NewIngestFunc(tpelastictransport.Interface)NewIngest

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

typeRequest

type Request struct {// ComponentTemplateSubstitutions A map of component template names to substitute component template definition// objects.ComponentTemplateSubstitutions map[string]types.ComponentTemplateNode `json:"component_template_substitutions,omitempty"`// Docs Sample documents to test in the pipeline.Docs []types.Document `json:"docs"`// IndexTemplateSubstitutions A map of index template names to substitute index template definition// objects.IndexTemplateSubstitutions map[string]types.IndexTemplate `json:"index_template_substitutions,omitempty"`MappingAddition            *types.TypeMapping             `json:"mapping_addition,omitempty"`// PipelineSubstitutions Pipelines to test.// If you don’t specify the `pipeline` request path parameter, this parameter is// required.// If you specify both this and the request path parameter, the API only uses// the request path parameter.PipelineSubstitutions map[string]types.IngestPipeline `json:"pipeline_substitutions,omitempty"`}

Request holds the request body struct for the package ingest

https://github.com/elastic/elasticsearch-specification/blob/470b4b9aaaa25cae633ec690e54b725c6fc939c7/specification/simulate/ingest/SimulateIngestRequest.ts#L29-L100

funcNewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request)FromJSON

func (r *Request) FromJSON(datastring) (*Request,error)

FromJSON allows to load an arbitrary json into the request structure

typeResponse

type Response struct {Docs []types.SimulateIngestDocumentResult `json:"docs"`}

Response holds the response body struct for the package ingest

https://github.com/elastic/elasticsearch-specification/blob/470b4b9aaaa25cae633ec690e54b725c6fc939c7/specification/simulate/ingest/SimulateIngestResponse.ts#L27-L29

funcNewResponse

func NewResponse() *Response

NewResponse returns a Response

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp