File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed
modules/streams/src/yamlRestTest/resources/rest-api-spec/test/streams/logs
server/src/main/java/org/elasticsearch/action/bulk Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1+ pr : 137992
2+ summary : Prevent passing a pipeline to a logs stream bulk index request body
3+ area : Data streams
4+ type : bug
5+ issues : []
Original file line number Diff line number Diff line change 1+ ---
2+ teardown :
3+ - do :
4+ streams.logs_disable : { }
5+
6+ ---
7+ " Check User Can't Provide Pipeline to Logs Stream " :
8+ - do :
9+ streams.logs_enable : { }
10+ - is_true : acknowledged
11+
12+ - do :
13+ streams.status : { }
14+ - is_true : logs.enabled
15+
16+ - do :
17+ bulk :
18+ index : logs
19+ body : |
20+ { "create": {"pipeline": "noop"}}
21+ { "message": "hello streams!"}
22+ - match : { errors: true }
23+ - match : { items.0.create.status: 400 }
24+ - match : { items.0.create.error.type: "illegal_argument_exception" }
25+ - match : { items.0.create.error.reason: "Cannot provide a pipeline when writing to a stream however the [noop] pipeline was provided when writing to the [logs] stream" }
Original file line number Diff line number Diff line change @@ -476,7 +476,16 @@ private void doStreamsChecks(
476476 + "] stream instead"
477477 );
478478 }
479-
479+ if (e == null && streamType .getStreamName ().equals (ir .index ()) && ir .getPipeline () != null ) {
480+ e = new IllegalArgumentException (
481+ "Cannot provide a pipeline when writing to a stream "
482+ + "however the ["
483+ + ir .getPipeline ()
484+ + "] pipeline was provided when writing to the ["
485+ + streamType .getStreamName ()
486+ + "] stream"
487+ );
488+ }
480489 if (e == null && streamsRestrictedParamsUsed (bulkRequest ) && req .index ().equals (streamType .getStreamName ())) {
481490 e = new IllegalArgumentException (
482491 "When writing to a stream, only the following parameters are allowed: ["
You can’t perform that action at this time.
0 commit comments