Skip to content

Commit 27edf77

Browse files
committed
Adding a test for data stream write indices
1 parent b19b82b commit 27edf77

File tree

1 file changed

+86
-0
lines changed
  • qa/smoke-test-ingest-with-all-dependencies/src/yamlRestTest/resources/rest-api-spec/test/ingest

1 file changed

+86
-0
lines changed

qa/smoke-test-ingest-with-all-dependencies/src/yamlRestTest/resources/rest-api-spec/test/ingest/80_ingest_simulate.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,3 +1800,89 @@ setup:
18001800
- match: { docs.0.doc._source.num: true }
18011801
- match: { docs.0.doc._source.is_valid: true }
18021802
- match: { docs.0.doc.error.type: "document_parsing_exception" }
1803+
1804+
---
1805+
"Test ingest simulate with mapping addition for data streams when write index has different mapping":
1806+
# In this test, we make sure that when the index template is a data stream template, simulate ingest works the same whether the data
1807+
# stream has been created or not -- either way, we expect it to use the template rather than the data stream / index mappings and settings.
1808+
1809+
- skip:
1810+
features:
1811+
- headers
1812+
- allowed_warnings
1813+
1814+
- do:
1815+
cluster.put_component_template:
1816+
name: mappings_template
1817+
body:
1818+
template:
1819+
mappings:
1820+
dynamic: strict
1821+
properties:
1822+
foo:
1823+
type: boolean
1824+
bar:
1825+
type: boolean
1826+
1827+
- do:
1828+
allowed_warnings:
1829+
- "index template [my-template-1] has index patterns [simple-data-stream1] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template-1] will take precedence during new index creation"
1830+
indices.put_index_template:
1831+
name: my-template-1
1832+
body:
1833+
index_patterns: [simple-data-stream1]
1834+
composed_of:
1835+
- mappings_template
1836+
data_stream: {}
1837+
1838+
- do:
1839+
indices.create_data_stream:
1840+
name: simple-data-stream1
1841+
- is_true: acknowledged
1842+
1843+
- do:
1844+
cluster.health:
1845+
wait_for_status: yellow
1846+
1847+
# Now that the data stream exists, we change the template to remove the mapping for bar. The write index still has the
1848+
# old mapping.
1849+
- do:
1850+
cluster.put_component_template:
1851+
name: mappings_template
1852+
body:
1853+
template:
1854+
mappings:
1855+
properties:
1856+
foo:
1857+
type: boolean
1858+
1859+
# We expect the mapping_addition to be added to the mapping of the write index, which has a boolean bar field. So this
1860+
# simulate ingest ought to fail.
1861+
- do:
1862+
headers:
1863+
Content-Type: application/json
1864+
simulate.ingest:
1865+
index: simple-data-stream1
1866+
body: >
1867+
{
1868+
"docs": [
1869+
{
1870+
"_id": "asdf",
1871+
"_source": {
1872+
"@timestamp": 1234,
1873+
"bar": "baz"
1874+
}
1875+
}
1876+
],
1877+
"mapping_addition": {
1878+
"properties": {
1879+
"baz": {
1880+
"type": "keyword"
1881+
}
1882+
}
1883+
}
1884+
}
1885+
- length: { docs: 1 }
1886+
- match: { docs.0.doc._index: "simple-data-stream1" }
1887+
- match: { docs.0.doc._source.bar: "baz" }
1888+
- match: { docs.0.doc.error.type: "document_parsing_exception" }

0 commit comments

Comments
 (0)