|
| 1 | +teardown: |
| 2 | + - do: |
| 3 | + cluster.put_settings: |
| 4 | + body: |
| 5 | + persistent: |
| 6 | + cluster.ingest.system_pipeline_enabled: "true" |
| 7 | + |
1 | 8 | ---
|
2 | 9 | "Processor injects a field on indexing a doc to existing index":
|
3 | 10 | - do:
|
|
106 | 113 |
|
107 | 114 | ---
|
108 | 115 | "Processor injects field on bulk index to non-existent index matching template":
|
| 116 | + - skip: |
| 117 | + features: allowed_warnings |
109 | 118 | - do:
|
110 | 119 | indices.put_template:
|
111 | 120 | name: bulk-template
|
|
116 | 125 | system_ingest_processor_trigger_field:
|
117 | 126 | type: keyword
|
118 | 127 | - do:
|
| 128 | + allowed_warnings: |
| 129 | + - "index [bulk-template-index-1] matches multiple legacy templates [bulk-template, global], composable templates will only match a single template" |
119 | 130 | bulk:
|
120 | 131 | refresh: true
|
121 | 132 | body:
|
|
141 | 152 | id: 2
|
142 | 153 | - match:
|
143 | 154 | _source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor."
|
| 155 | + |
| 156 | +--- |
| 157 | +"Processor injects field on bulk update, upsert on existing/new documents": |
| 158 | + # Temporarily disable system ingest pipelines to insert without triggering the system ingest field |
| 159 | + - do: |
| 160 | + cluster.put_settings: |
| 161 | + body: |
| 162 | + persistent: |
| 163 | + cluster.ingest.system_pipeline_enabled: "false" |
| 164 | + |
| 165 | + - do: |
| 166 | + indices.create: |
| 167 | + index: bulk-index |
| 168 | + body: |
| 169 | + mappings: |
| 170 | + properties: |
| 171 | + system_ingest_processor_trigger_field: |
| 172 | + type: keyword |
| 173 | + |
| 174 | +# Index documents to be updated on later step |
| 175 | + - do: |
| 176 | + bulk: |
| 177 | + refresh: true |
| 178 | + body: |
| 179 | + - index: |
| 180 | + _index: bulk-index |
| 181 | + _id: "1" |
| 182 | + - system_ingest_processor_trigger_field: "bulk1" |
| 183 | + - index: |
| 184 | + _index: bulk-index |
| 185 | + _id: "2" |
| 186 | + - system_ingest_processor_trigger_field: "bulk2" |
| 187 | + - index: |
| 188 | + _index: bulk-index |
| 189 | + _id: "3" |
| 190 | + - system_ingest_processor_trigger_field: "bulk3" |
| 191 | + |
| 192 | +# Verify system ingest pipelines weren't triggered on regular index operations |
| 193 | + - do: |
| 194 | + get: |
| 195 | + index: bulk-index |
| 196 | + id: 1 |
| 197 | + - match: |
| 198 | + _source.field_auto_added_by_system_ingest_processor: null |
| 199 | + |
| 200 | + - do: |
| 201 | + get: |
| 202 | + index: bulk-index |
| 203 | + id: 2 |
| 204 | + - match: |
| 205 | + _source.field_auto_added_by_system_ingest_processor: null |
| 206 | + |
| 207 | + - do: |
| 208 | + get: |
| 209 | + index: bulk-index |
| 210 | + id: 2 |
| 211 | + - match: |
| 212 | + _source.field_auto_added_by_system_ingest_processor: null |
| 213 | + |
| 214 | +# Reenable system ingest pipeline |
| 215 | + - do: |
| 216 | + cluster.put_settings: |
| 217 | + body: |
| 218 | + persistent: |
| 219 | + cluster.ingest.system_pipeline_enabled: "true" |
| 220 | + |
| 221 | +# Bulk update, bulk upsert existing, and bulk upsert new should all trigger ingest pipelines |
| 222 | + - do: |
| 223 | + bulk: |
| 224 | + refresh: true |
| 225 | + body: |
| 226 | + - update: |
| 227 | + _index: bulk-index |
| 228 | + _id: "1" |
| 229 | + - doc: |
| 230 | + system_ingest_processor_trigger_field: "update bulk1" |
| 231 | + - update: |
| 232 | + _index: bulk-index |
| 233 | + _id: "2" |
| 234 | + - doc: |
| 235 | + system_ingest_processor_trigger_field: "update bulk2" |
| 236 | + upsert: |
| 237 | + system_ingest_processor_trigger_field: "new upsert bulk2" |
| 238 | + - update: |
| 239 | + _index: bulk-index |
| 240 | + _id: "3" |
| 241 | + - doc: |
| 242 | + system_ingest_processor_trigger_field: "doc as upsert bulk3" |
| 243 | + doc_as_upsert: true |
| 244 | + - update: |
| 245 | + _index: bulk-index |
| 246 | + _id: "4" |
| 247 | + - doc: |
| 248 | + system_ingest_processor_trigger_field: "update bulk4" |
| 249 | + upsert: |
| 250 | + system_ingest_processor_trigger_field: "new upsert bulk4" |
| 251 | + |
| 252 | + - do: |
| 253 | + get: |
| 254 | + index: bulk-index |
| 255 | + id: 1 |
| 256 | + - match: |
| 257 | + _source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor." |
| 258 | + - match: |
| 259 | + _source.system_ingest_processor_trigger_field: "update bulk1" |
| 260 | + |
| 261 | + - do: |
| 262 | + get: |
| 263 | + index: bulk-index |
| 264 | + id: 2 |
| 265 | + - match: |
| 266 | + _source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor." |
| 267 | + - match: |
| 268 | + _source.system_ingest_processor_trigger_field: "update bulk2" |
| 269 | + |
| 270 | + - do: |
| 271 | + get: |
| 272 | + index: bulk-index |
| 273 | + id: 3 |
| 274 | + - match: |
| 275 | + _source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor." |
| 276 | + - match: |
| 277 | + _source.system_ingest_processor_trigger_field: "doc as upsert bulk3" |
| 278 | + |
| 279 | + - do: |
| 280 | + get: |
| 281 | + index: bulk-index |
| 282 | + id: 4 |
| 283 | + - match: |
| 284 | + _source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor." |
| 285 | + - match: |
| 286 | + _source.system_ingest_processor_trigger_field: "new upsert bulk4" |
0 commit comments