33using System . ComponentModel ;
44
55namespace Elasticsearch . Net
6- {
6+ {
77 /// <summary>
88 /// ConnectionConfiguration allows you to control how ElasticsearchClient behaves and where/how it connects
99 /// to elasticsearch
@@ -12,40 +12,40 @@ public class ConnectionConfiguration : ConnectionConfiguration<ConnectionConfigu
1212 {
1313 public static TimeSpan DefaultTimeout = TimeSpan . FromMinutes ( 1 ) ;
1414 public static TimeSpan DefaultPingTimeout = TimeSpan . FromSeconds ( 2 ) ;
15- public static TimeSpan DefaultPingTimeoutOnSSL = TimeSpan . FromSeconds ( 5 ) ;
16-
15+ public static TimeSpan DefaultPingTimeoutOnSSL = TimeSpan . FromSeconds ( 5 ) ;
16+
1717 /// <summary>
1818 /// ConnectionConfiguration allows you to control how ElasticsearchClient behaves and where/how it connects
1919 /// to elasticsearch
2020 /// </summary>
2121 /// <param name="uri">The root of the elasticsearch node we want to connect to. Defaults to http://localhost:9200</param>
2222 public ConnectionConfiguration ( Uri uri = null )
23- : this ( new SingleNodeConnectionPool ( uri ?? new Uri ( "http://localhost:9200" ) ) )
24- { }
25-
23+ : this ( new SingleNodeConnectionPool ( uri ?? new Uri ( "http://localhost:9200" ) ) )
24+ { }
25+
2626 /// <summary>
2727 /// ConnectionConfiguration allows you to control how ElasticsearchClient behaves and where/how it connects
2828 /// to elasticsearch
2929 /// </summary>
3030 /// <param name="connectionPool">A connection pool implementation that'll tell the client what nodes are available</param>
31- public ConnectionConfiguration ( IConnectionPool connectionPool )
32- // ReSharper disable once IntroduceOptionalParameters.Global
33- : this ( connectionPool , null , null )
31+ public ConnectionConfiguration ( IConnectionPool connectionPool )
32+ // ReSharper disable once IntroduceOptionalParameters.Global
33+ : this ( connectionPool , null , null )
3434 { }
3535
36- public ConnectionConfiguration ( IConnectionPool connectionPool , IConnection connection )
37- // ReSharper disable once IntroduceOptionalParameters.Global
38- : this ( connectionPool , connection , null )
36+ public ConnectionConfiguration ( IConnectionPool connectionPool , IConnection connection )
37+ // ReSharper disable once IntroduceOptionalParameters.Global
38+ : this ( connectionPool , connection , null )
3939 { }
4040
4141 public ConnectionConfiguration ( IConnectionPool connectionPool , IElasticsearchSerializer serializer )
42- : this ( connectionPool , null , serializer )
43- { }
44-
45- // ReSharper disable once MemberCanBePrivate.Global
46- // eventhough we use don't use this we very much would like to expose this constructor
42+ : this ( connectionPool , null , serializer )
43+ { }
44+
45+ // ReSharper disable once MemberCanBePrivate.Global
46+ // eventhough we use don't use this we very much would like to expose this constructor
4747 public ConnectionConfiguration ( IConnectionPool connectionPool , IConnection connection , IElasticsearchSerializer serializer )
48- : base ( connectionPool , connection , serializer )
48+ : base ( connectionPool , connection , serializer )
4949 { }
5050 }
5151
@@ -111,8 +111,8 @@ public abstract class ConnectionConfiguration<T> : IConnectionConfigurationValue
111111 private bool _enableHttpCompression ;
112112 bool IConnectionConfigurationValues . EnableHttpCompression => _enableHttpCompression ;
113113
114- private bool _httpPipeliningEnabled = true ;
115- bool IConnectionConfigurationValues . HttpPipeliningEnabled => _httpPipeliningEnabled ;
114+ private bool _enableHttpPipelining = true ;
115+ bool IConnectionConfigurationValues . HttpPipeliningEnabled => _enableHttpPipelining ;
116116
117117 private bool _throwExceptions ;
118118 bool IConnectionConfigurationValues . ThrowExceptions => _throwExceptions ;
@@ -140,13 +140,13 @@ private static void DefaultApiCallHandler(IApiCallDetails status) { }
140140 IConnection IConnectionConfigurationValues . Connection => _connection ;
141141
142142 [ System . Diagnostics . CodeAnalysis . SuppressMessage (
143- "Potential Code Quality Issues" , "RECS0021:Warns about calls to virtual member functions occuring in the constructor" ,
143+ "Potential Code Quality Issues" , "RECS0021:Warns about calls to virtual member functions occuring in the constructor" ,
144144 Justification = "We want the virtual method to run on most derived" ) ]
145145 protected ConnectionConfiguration ( IConnectionPool connectionPool , IConnection connection , IElasticsearchSerializer serializer )
146146 {
147147 this . _connectionPool = connectionPool ;
148- this . _connection = connection ?? new HttpConnection ( ) ;
149- // ReSharper disable once VirtualMemberCallInContructor
148+ this . _connection = connection ?? new HttpConnection ( ) ;
149+ // ReSharper disable once VirtualMemberCallInContructor
150150 this . _serializer = serializer ?? this . DefaultSerializer ( ) ;
151151
152152 this . _requestTimeout = ConnectionConfiguration . DefaultTimeout ;
@@ -162,95 +162,95 @@ protected ConnectionConfiguration(IConnectionPool connectionPool, IConnection co
162162 public T EnableTcpKeepAlive ( TimeSpan keepAliveTime , TimeSpan keepAliveInterval ) =>
163163 Assign ( a => { this . _keepAliveTime = keepAliveTime ; this . _keepAliveInterval = keepAliveInterval ; } ) ;
164164
165- public T MaximumRetries ( int maxRetries ) => Assign ( a => a . _maxRetries = maxRetries ) ;
166-
165+ public T MaximumRetries ( int maxRetries ) => Assign ( a => a . _maxRetries = maxRetries ) ;
166+
167167 /// <summary>
168168 /// On connection pools that support reseeding setting this to true (default) will resniff the cluster when a call fails
169169 /// </summary>
170- public T SniffOnConnectionFault ( bool sniffsOnConnectionFault = true ) => Assign ( a => a . _sniffOnConnectionFault = sniffsOnConnectionFault ) ;
171-
170+ public T SniffOnConnectionFault ( bool sniffsOnConnectionFault = true ) => Assign ( a => a . _sniffOnConnectionFault = sniffsOnConnectionFault ) ;
171+
172172 /// <summary>
173173 /// Enables sniffing on first usage of a connection pool if that pool supports reseeding, defaults to true
174174 /// </summary>
175- public T SniffOnStartup ( bool sniffsOnStartup = true ) => Assign ( a => a . _sniffOnStartup = sniffsOnStartup ) ;
176-
175+ public T SniffOnStartup ( bool sniffsOnStartup = true ) => Assign ( a => a . _sniffOnStartup = sniffsOnStartup ) ;
176+
177177 /// <summary>
178178 /// Set the duration after which a cluster state is considered stale and a sniff should be performed again.
179179 /// An IConnectionPool has to signal it supports reseeding otherwise sniffing will never happen.
180180 /// Defaults to 1 hour.
181181 /// Set to null to disable completely. Sniffing will only ever happen on ConnectionPools that return true for SupportsReseeding
182182 /// </summary>
183183 /// <param name="sniffLifeSpan">The duration a clusterstate is considered fresh, set to null to disable periodic sniffing</param>
184- public T SniffLifeSpan ( TimeSpan ? sniffLifeSpan ) => Assign ( a => a . _sniffLifeSpan = sniffLifeSpan ) ;
185-
184+ public T SniffLifeSpan ( TimeSpan ? sniffLifeSpan ) => Assign ( a => a . _sniffLifeSpan = sniffLifeSpan ) ;
185+
186186 /// <summary>
187187 /// Enable gzip compressed requests and responses, do note that you need to configure elasticsearch to set this
188188 /// <para>http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-http.html"</para>
189189 /// </summary>
190190 public T EnableHttpCompression ( bool enabled = true ) => Assign ( a => a . _enableHttpCompression = enabled ) ;
191191
192- public T DisableAutomaticProxyDetection ( bool disable = true ) => Assign ( a => a . _disableAutomaticProxyDetection = disable ) ;
193-
192+ public T DisableAutomaticProxyDetection ( bool disable = true ) => Assign ( a => a . _disableAutomaticProxyDetection = disable ) ;
193+
194194 /// <summary>
195195 /// Instead of following a c/go like error checking on response.IsValid always throw an exception
196196 /// on the client when a call resulted in an exception on either the client or the Elasticsearch server.
197197 /// <para>Reasons for such exceptions could be search parser errors, index missing exceptions, etc...</para>
198198 /// </summary>
199- public T ThrowExceptions ( bool alwaysThrow = true ) => Assign ( a => a . _throwExceptions = alwaysThrow ) ;
200-
199+ public T ThrowExceptions ( bool alwaysThrow = true ) => Assign ( a => a . _throwExceptions = alwaysThrow ) ;
200+
201201 /// <summary>
202202 /// When a node is used for the very first time or when it's used for the first time after it has been marked dead
203203 /// a ping with a very low timeout is send to the node to make sure that when it's still dead it reports it as fast as possible.
204204 /// You can disable these pings globally here if you rather have it fail on the possible slower original request
205205 /// </summary>
206- public T DisablePing ( bool disable = true ) => Assign ( a => a . _disablePings = disable ) ;
207-
206+ public T DisablePing ( bool disable = true ) => Assign ( a => a . _disablePings = disable ) ;
207+
208208 /// <summary>
209209 /// This NameValueCollection will be appended to every url NEST calls, great if you need to pass i.e an API key.
210210 /// </summary>
211- public T GlobalQueryStringParameters ( NameValueCollection queryStringParameters ) => Assign ( a => a . _queryString . Add ( queryStringParameters ) ) ;
212-
211+ public T GlobalQueryStringParameters ( NameValueCollection queryStringParameters ) => Assign ( a => a . _queryString . Add ( queryStringParameters ) ) ;
212+
213213 /// <summary>
214214 /// a NameValueCollection that will be send as headers for each request
215215 /// </summary>
216- public T GlobalHeaders ( NameValueCollection headers ) => Assign ( a => a . _headers . Add ( headers ) ) ;
217-
216+ public T GlobalHeaders ( NameValueCollection headers ) => Assign ( a => a . _headers . Add ( headers ) ) ;
217+
218218 /// <summary>
219219 /// Sets the default timeout in milliseconds for each request to Elasticsearch.
220220 /// NOTE: You can set this to a high value here, and specify the timeout on Elasticsearch's side.
221221 /// </summary>
222222 /// <param name="timeout">time out in milliseconds</param>
223- public T RequestTimeout ( TimeSpan timeout ) => Assign ( a => a . _requestTimeout = timeout ) ;
224-
223+ public T RequestTimeout ( TimeSpan timeout ) => Assign ( a => a . _requestTimeout = timeout ) ;
224+
225225 /// <summary>
226226 /// Sets the default ping timeout in milliseconds for ping requests, which are used
227227 /// to determine whether a node is alive. Pings should fail as fast as possible.
228228 /// </summary>
229229 /// <param name="timeout">The ping timeout in milliseconds defaults to 1000, or 2000 is using SSL.</param>
230- public T PingTimeout ( TimeSpan timeout ) => Assign ( a => a . _pingTimeout = timeout ) ;
231-
230+ public T PingTimeout ( TimeSpan timeout ) => Assign ( a => a . _pingTimeout = timeout ) ;
231+
232232 /// <summary>
233233 /// Sets the default dead timeout factor when a node has been marked dead.
234234 /// </summary>
235235 /// <remarks>Some connection pools may use a flat timeout whilst others take this factor and increase it exponentially</remarks>
236236 /// <param name="timeout"></param>
237- public T DeadTimeout ( TimeSpan timeout ) => Assign ( a => a . _deadTimeout = timeout ) ;
238-
237+ public T DeadTimeout ( TimeSpan timeout ) => Assign ( a => a . _deadTimeout = timeout ) ;
238+
239239 /// <summary>
240240 /// Sets the maximum time a node can be marked dead.
241241 /// Different implementations of IConnectionPool may choose a different default.
242242 /// </summary>
243243 /// <param name="timeout">The timeout in milliseconds</param>
244- public T MaxDeadTimeout ( TimeSpan timeout ) => Assign ( a => a . _maxDeadTimeout = timeout ) ;
245-
244+ public T MaxDeadTimeout ( TimeSpan timeout ) => Assign ( a => a . _maxDeadTimeout = timeout ) ;
245+
246246 /// <summary>
247247 /// Limits the total runtime including retries separately from <see cref="RequestTimeout"/>
248248 /// <pre>
249249 /// When not specified defaults to <see cref="RequestTimeout"/> which itself defaults to 60seconds
250250 /// </pre>
251251 /// </summary>
252- public T MaxRetryTimeout ( TimeSpan maxRetryTimeout ) => Assign ( a => a . _maxRetryTimeout = maxRetryTimeout ) ;
253-
252+ public T MaxRetryTimeout ( TimeSpan maxRetryTimeout ) => Assign ( a => a . _maxRetryTimeout = maxRetryTimeout ) ;
253+
254254 /// <summary>
255255 /// If your connection has to go through proxy use this method to specify the proxy url
256256 /// </summary>
@@ -261,33 +261,33 @@ public T Proxy(Uri proxyAdress, string username, string password)
261261 this . _proxyUsername = username ;
262262 this . _proxyPassword = password ;
263263 return ( T ) this ;
264- }
265-
264+ }
265+
266266 /// <summary>
267267 /// Forces all requests to have ?pretty=true, causing elasticsearch to return formatted json.
268268 /// Also forces the client to send out formatted json. Defaults to false
269269 /// </summary>
270- public T PrettyJson ( bool b = true ) => Assign ( a =>
270+ public T PrettyJson ( bool b = true ) => Assign ( a =>
271271 {
272272 this . _prettyJson = b ;
273273 if ( ! b && this . _queryString [ "pretty" ] != null ) this . _queryString . Remove ( "pretty" ) ;
274274 else if ( b && this . _queryString [ "pretty" ] == null )
275- this . GlobalQueryStringParameters ( new NameValueCollection { { "pretty" , b . ToString ( ) . ToLowerInvariant ( ) } } ) ;
276- } ) ;
277-
275+ this . GlobalQueryStringParameters ( new NameValueCollection { { "pretty" , b . ToString ( ) . ToLowerInvariant ( ) } } ) ;
276+ } ) ;
277+
278278 /// <summary>
279279 /// Make sure the reponse bytes are always available on the ElasticsearchResponse object
280280 /// <para>Note: that depending on the registered serializer this may cause the respond to be read in memory first</para>
281281 /// </summary>
282- public T DisableDirectStreaming ( bool b = true ) => Assign ( a => a . _disableDirectStreaming = b ) ;
283-
282+ public T DisableDirectStreaming ( bool b = true ) => Assign ( a => a . _disableDirectStreaming = b ) ;
283+
284284 /// <summary>
285285 /// Global callback for every response that NEST receives, useful for custom logging.
286286 /// Calling this multiple times will register multiple listeners
287287 /// </summary>
288288 public T ConnectionStatusHandler ( Action < IApiCallDetails > handler ) =>
289- Assign ( a => a . _apiCallHandler += handler ?? DefaultApiCallHandler ) ;
290-
289+ Assign ( a => a . _apiCallHandler += handler ?? DefaultApiCallHandler ) ;
290+
291291 /// <summary>
292292 /// Basic access authentication credentials to specify with all requests.
293293 /// </summary>
@@ -299,13 +299,13 @@ public T BasicAuthentication(string userName, string password)
299299 Password = password
300300 } ;
301301 return ( T ) this ;
302- }
303-
302+ }
303+
304304 /// <summary>
305305 /// Allows for requests to be pipelined. http://en.wikipedia.org/wiki/HTTP_pipelining
306306 /// <para>Note: HTTP pipelining must also be enabled in Elasticsearch for this to work properly.</para>
307307 /// </summary>
308- public T HttpPipeliningEnabled ( bool enabled = true ) => Assign ( a => a . _httpPipeliningEnabled = enabled ) ;
308+ public T EnableHttpPipelining ( bool enabled = true ) => Assign ( a => a . _enableHttpPipelining = enabled ) ;
309309 }
310310}
311311
0 commit comments