Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e2eb1de
Simulate ingest API template_substitutions prototype
masseyke Sep 11, 2024
0818e53
Update docs/changelog/112762.yaml
masseyke Sep 11, 2024
1d5a686
fixing compilation error
masseyke Sep 11, 2024
88b1b9c
Merge branch 'component-template-substitutions-for-simulate' of githu…
masseyke Sep 11, 2024
f9b7717
Fixing TransportSimulateBulkActionIT to use the correct request type
masseyke Sep 11, 2024
f1dff59
removing duplicate method from TransportSimulateIndexTemplateAction
masseyke Sep 11, 2024
772b2f1
removing if/else logic around simualte bulk request or normal bulk re…
masseyke Sep 11, 2024
ae91dac
adding back accidentally removed line
masseyke Sep 11, 2024
c65544e
adding comments to TransportSimulateBulkAction
masseyke Sep 11, 2024
06c9444
removing duplicate methods
masseyke Sep 11, 2024
fecb62d
fixing shallowClone methods
masseyke Sep 12, 2024
68b6df3
Changing template_substitutions to component_template_substitutions
masseyke Sep 12, 2024
d30bf92
removing verbose logging
masseyke Sep 12, 2024
13ad434
adding an integration test
masseyke Sep 12, 2024
6655f7a
merging main
masseyke Sep 12, 2024
c7dd111
fixing behavior when component template overrides remove pipeline config
masseyke Sep 13, 2024
19b8a19
Merge branch 'main' into component-template-substitutions-for-simulate
masseyke Sep 13, 2024
4355867
unit testing SimulateBulkRequestTests
masseyke Sep 13, 2024
b7b2429
imporving the changelog
masseyke Sep 13, 2024
15f7445
cleanup
masseyke Sep 13, 2024
3e74db4
reverting accidental commit
masseyke Sep 13, 2024
0812fca
adding documentation
masseyke Sep 13, 2024
651bd94
fixing SuppressWarnings
masseyke Sep 13, 2024
3bea3e2
fixing docs
masseyke Sep 13, 2024
d1ccfaf
Merge branch 'main' into component-template-substitutions-for-simulate
masseyke Sep 13, 2024
78d2b0f
merging main
masseyke Sep 17, 2024
92d8568
handling new component_template_substitutions format
masseyke Sep 17, 2024
3a73cfe
Making transport changes to enable component template substitutions i…
masseyke Sep 17, 2024
d738c64
removing native library hack
masseyke Sep 17, 2024
3451005
Merge branch 'main' into adding-transport-code-for-simulate-ingest-co…
masseyke Sep 18, 2024
63bc263
Merge branch 'main' into adding-transport-code-for-simulate-ingest-co…
masseyke Sep 18, 2024
fc2ceba
Adding an assertion about component template substitutions to Transpo…
masseyke Sep 19, 2024
c36a448
reverting change to Metadata
masseyke Sep 19, 2024
88c6edf
renaming templateSubstitutions -> componentTemplateSubstitutions in I…
masseyke Sep 19, 2024
03b782a
Merge branch 'main' into adding-transport-code-for-simulate-ingest-co…
masseyke Sep 19, 2024
fbc6b54
Merge branch 'main' into adding-transport-code-for-simulate-ingest-co…
masseyke Sep 19, 2024
580ae35
Merge branch 'main' into adding-transport-code-for-simulate-ingest-co…
masseyke Sep 19, 2024
0ea8000
Merge branch 'main' into adding-transport-code-for-simulate-ingest-co…
masseyke Sep 19, 2024
8983675
Merge branch 'main' into adding-transport-code-for-simulate-ingest-co…
masseyke Sep 19, 2024
2238441
merging
masseyke Sep 19, 2024
72e647f
Merge branch 'main' into component-template-substitutions-for-simulate
masseyke Sep 19, 2024
b2eac95
fixing documentation
masseyke Sep 20, 2024
e4b50d5
Merge branch 'main' into component-template-substitutions-for-simulate
masseyke Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/112762.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 112762
summary: Adding the ability to include component template substitutions in simulate ingest API requests
area: Ingest Node
type: enhancement
issues: []
7 changes: 5 additions & 2 deletions docs/reference/indices/put-component-template.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@ include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
[[put-component-template-api-request-body]]
==== {api-request-body-title}

// tag::template[]

`template`::
(Required, object)
This is the template to be applied, may optionally include a `mappings`,
`settings`, or `aliases` configuration.
+
.Properties of `template`
[%collapsible%open]
====
=====
`aliases`::
(Optional, object of objects) Aliases to add.
+
Expand All @@ -147,7 +149,7 @@ include::{es-ref-dir}/indices/create-index.asciidoc[tag=aliases-props]
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=mappings]

include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=settings]
====
=====

`version`::
(Optional, integer)
Expand All @@ -174,6 +176,7 @@ This map is not automatically generated by {es}.
Marks this component template as deprecated.
When a deprecated component template is referenced when creating or updating a non-deprecated index template,
{es} will emit a deprecation warning.
end::template[]

[[put-component-template-api-example]]
==== {api-examples-title}
Expand Down
118 changes: 117 additions & 1 deletion docs/reference/ingest/apis/simulate-ingest.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,32 @@ POST /_ingest/_simulate
}
]
}
},
"component_template_substitutions": { <2>
"my-component-template": {
"template": {
"mappings": {
"dynamic": "true",
"properties": {
"field3": {
"type": "keyword"
}
}
},
"settings": {
"index": {
"default_pipeline": "my-pipeline"
}
}
}
}
}
}
----

<1> This replaces the existing `my-pipeline` pipeline with the contents given here for the duration of this request.
<2> This replaces the existing `my-component-template` component template with the contents given here for the duration of this request.
These templates can be used to change the pipeline(s) used, or to modify the mapping that will be used to validate the result.

[[simulate-ingest-api-request]]
==== {api-request-title}
Expand Down Expand Up @@ -191,6 +212,19 @@ Map of pipeline IDs to substitute pipeline definition objects.
include::put-pipeline.asciidoc[tag=pipeline-object]
====

`component_template_substitutions`::
(Optional, map of strings to objects)
Map of component template names to substitute component template definition objects.
+
.Properties of component template definition objects
[%collapsible%open]

====

include::{es-ref-dir}/indices/put-component-template.asciidoc[tag=template]

====

[[simulate-ingest-api-example]]
==== {api-examples-title}

Expand Down Expand Up @@ -268,7 +302,7 @@ The API returns the following response:

[[simulate-ingest-api-request-body-ex]]
===== Specify a pipeline substitution in the request body
In this example the index `index` has a default pipeline called `my-pipeline` and a final
In this example the index `my-index` has a default pipeline called `my-pipeline` and a final
pipeline called `my-final-pipeline`. But a substitute definition of `my-pipeline` is
provided in `pipeline_substitutions`. The substitute `my-pipeline` will be used in place of
the `my-pipeline` that is in the system, and then the `my-final-pipeline` that is already
Expand Down Expand Up @@ -348,6 +382,87 @@ The API returns the following response:
}
----

[[simulate-ingest-api-substitute-component-templates-ex]]
===== Specify a component template substitution in the request body
In this example, imagine that the index `my-index` has a strict mapping with only the `foo`
keyword field defined. Say that field mapping came from a component template named
`my-mappings-template`. We want to test adding a new field, `bar`. So a substitute definition of
`my-mappings-template` is provided in `component_template_substitutions`. The substitute
`my-mappings-template` will be used in place of the existing mapping for `my-index` and in place
of the `my-mappings-template` that is in the system.

[source,console]
----
POST /_ingest/_simulate
{
"docs": [
{
"_index": "my-index",
"_id": "123",
"_source": {
"foo": "foo"
}
},
{
"_index": "my-index",
"_id": "456",
"_source": {
"bar": "rab"
}
}
],
"component_template_substitutions": {
"my-mappings_template": {
"template": {
"mappings": {
"dynamic": "strict",
"properties": {
"foo": {
"type": "keyword"
},
"bar": {
"type": "keyword"
}
}
}
}
}
}
}
----

The API returns the following response:

[source,console-result]
----
{
"docs": [
{
"doc": {
"_id": "123",
"_index": "my-index",
"_version": -3,
"_source": {
"foo": "foo"
},
"executed_pipelines": []
}
},
{
"doc": {
"_id": "456",
"_index": "my-index",
"_version": -3,
"_source": {
"bar": "rab"
},
"executed_pipelines": []
}
}
]
}
----

////
[source,console]
----
Expand All @@ -363,3 +478,4 @@ DELETE /_ingest/pipeline/*
}
----
////

Loading