-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathSimulateIngestRequest.ts
100 lines (98 loc) · 4.68 KB
/
SimulateIngestRequest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { ComponentTemplateNode } from '@cluster/_types/ComponentTemplate'
import { IndexTemplate } from '@indices/_types/IndexTemplate'
import { Pipeline } from '@ingest/_types/Pipeline'
import { Document } from '@ingest/_types/Simulation'
import { Dictionary } from '@spec_utils/Dictionary'
import { RequestBase } from '@_types/Base'
import { IndexName, PipelineName } from '@_types/common'
import { TypeMapping } from '@_types/mapping/TypeMapping'
/**
* Simulate data ingestion.
* Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index.
*
* This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch.
*
* The API runs the default and final pipeline for that index against a set of documents provided in the body of the request.
* If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would.
* No data is indexed into Elasticsearch.
* Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation.
* The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result.
*
* This API differs from the simulate pipeline API in that you specify a single pipeline 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 the interaction of the various pipelines that get applied when ingesting into an index.
*
* By default, the pipeline definitions that are currently in the system are used.
* However, you can supply substitute pipeline definitions in the body of the request.
* These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request.
* @rest_spec_name simulate.ingest
* @availability stack since=8.12.0 stability=experimental visibility=public
* @index_privileges index
* @doc_tag ingest
* @doc_id simulate-ingest-api
*/
export interface Request extends RequestBase {
urls: [
{
path: '/_ingest/_simulate'
methods: ['GET', 'POST']
},
{
path: '/_ingest/{index}/_simulate'
methods: ['GET', 'POST']
}
]
path_parts: {
/**
* 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 any documents that do not explicitly specify an index argument.
*/
index?: IndexName
}
query_parameters: {
/**
* The pipeline to use as the default pipeline.
* This value can be used to override the default pipeline of the index.
*/
pipeline?: PipelineName
}
body: {
/**
* Sample documents to test in the pipeline.
*/
docs: Document[]
/**
* A map of component template names to substitute component template definition objects.
*/
component_template_substitutions?: Dictionary<string, ComponentTemplateNode>
/**
* A map of index template names to substitute index template definition objects.
*/
index_template_substitutions?: Dictionary<string, IndexTemplate>
mapping_addition?: TypeMapping
/**
* 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.
*/
pipeline_substitutions?: Dictionary<string, Pipeline>
}
}