@@ -35,6 +35,7 @@ use vector_lib::lookup::event_path;
3535use vector_lib:: lookup:: lookup_v2:: ConfigValuePath ;
3636use vector_lib:: schema:: Requirement ;
3737use vrl:: value:: Kind ;
38+ use crate :: sinks:: util:: http:: ConnectionConfig ;
3839
3940/// The field name for the timestamp required by data stream mode
4041pub const DATA_STREAM_TIMESTAMP_KEY : & str = "@timestamp" ;
@@ -218,6 +219,16 @@ pub struct ElasticsearchConfig {
218219 ) ]
219220 #[ configurable( derived) ]
220221 pub acknowledgements : AcknowledgementsConfig ,
222+
223+
224+ /// Connection-level settings for the underlying HTTP client.
225+ ///
226+ /// This allows configuring parameters like connection idle timeout and
227+ /// maximum idle connections per host. Useful when running behind load
228+ /// balancers with strict idle policies.
229+ #[ configurable( derived) ]
230+ #[ serde( default ) ]
231+ pub connection : Option < ConnectionConfig > ,
221232}
222233
223234fn default_doc_type ( ) -> String {
@@ -255,6 +266,7 @@ impl Default for ElasticsearchConfig {
255266 data_stream : None ,
256267 metrics : None ,
257268 acknowledgements : Default :: default ( ) ,
269+ connection : None ,
258270 }
259271 }
260272}
@@ -541,7 +553,7 @@ impl SinkConfig for ElasticsearchConfig {
541553 let commons = ElasticsearchCommon :: parse_many ( self , cx. proxy ( ) ) . await ?;
542554 let common = commons[ 0 ] . clone ( ) ;
543555
544- let client = HttpClient :: new ( common. tls_settings . clone ( ) , cx. proxy ( ) ) ?;
556+ let client = HttpClient :: new_with_connection_config ( common. tls_settings . clone ( ) , cx. proxy ( ) , self . connection ) ?;
545557
546558 let request_limits = self . request . tower . into_settings ( ) ;
547559
0 commit comments