@@ -41,6 +41,8 @@ pub struct ElasticSearchConfig {
4141 pub index : Option < String > ,
4242 pub doc_type : Option < String > ,
4343 pub id_key : Option < String > ,
44+ pub pipeline : Option < String > ,
45+
4446 #[ serde( default ) ]
4547 pub compression : Compression ,
4648 #[ serde(
@@ -353,6 +355,10 @@ impl ElasticSearchCommon {
353355 let mut query_params = config. query . clone ( ) . unwrap_or_default ( ) ;
354356 query_params. insert ( "timeout" . into ( ) , format ! ( "{}s" , request. timeout. as_secs( ) ) ) ;
355357
358+ if let Some ( pipeline) = & config. pipeline {
359+ query_params. insert ( "pipeline" . into ( ) , pipeline. into ( ) ) ;
360+ }
361+
356362 let mut query = url:: form_urlencoded:: Serializer :: new ( String :: new ( ) ) ;
357363 for ( p, v) in & query_params {
358364 query. append_pair ( & p[ ..] , & v[ ..] ) ;
@@ -523,6 +529,22 @@ mod integration_tests {
523529 use std:: fs:: File ;
524530 use std:: io:: Read ;
525531
532+ #[ test]
533+ fn ensure_pipeline_in_params ( ) {
534+ let index = gen_index ( ) ;
535+ let pipeline = String :: from ( "test-pipeline" ) ;
536+
537+ let config = ElasticSearchConfig {
538+ host : "http://localhost:9200" . into ( ) ,
539+ index : Some ( index. clone ( ) ) ,
540+ pipeline : Some ( pipeline. clone ( ) ) ,
541+ ..config ( )
542+ } ;
543+ let common = ElasticSearchCommon :: parse_config ( & config) . expect ( "Config error" ) ;
544+
545+ assert_eq ! ( common. query_params[ "pipeline" ] , pipeline) ;
546+ }
547+
526548 #[ test]
527549 fn structures_events_correctly ( ) {
528550 let mut rt = runtime ( ) ;
0 commit comments