Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion src/sinks/elasticsearch/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ impl ElasticsearchCommon {
);

if let Some(pipeline) = &config.pipeline {
query_params.insert("pipeline".into(), pipeline.into());
if !pipeline.is_empty() {
query_params.insert("pipeline".into(), pipeline.into());
}
}

let bulk_url = {
Expand Down
22 changes: 22 additions & 0 deletions src/sinks/elasticsearch/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,28 @@ async fn ensure_pipeline_in_params() {
assert_eq!(common.query_params["pipeline"], pipeline);
}

#[tokio::test]
async fn ensure_empty_pipeline_not_in_params() {
let index = gen_index();
let pipeline = String::from("");

let config = ElasticsearchConfig {
endpoints: vec![http_server()],
bulk: BulkConfig {
index,
..Default::default()
},
pipeline: Some(pipeline.clone()),
batch: batch_settings(),
..Default::default()
};
let common = ElasticsearchCommon::parse_single(&config)
.await
.expect("Config error");

assert_eq!(common.query_params.get("pipeline"), None);
}

#[tokio::test]
async fn structures_events_correctly() {
let index = gen_index();
Expand Down