Class ConnectionConfiguration
Allows you to control how OpenSearchLowLevelClient behaves and where/how it connects to OpenSearch
Inherited Members
Namespace: OpenSearch.Net
Assembly: OpenSearch.Net.dll
Syntax
public class ConnectionConfiguration : ConnectionConfiguration<ConnectionConfiguration>, IConnectionConfigurationValues, IDisposable
Constructors
| Edit this page View SourceConnectionConfiguration(IConnectionPool)
Creates a new instance of ConnectionConfiguration
Declaration
public ConnectionConfiguration(IConnectionPool connectionPool)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnectionPool | connectionPool | A connection pool implementation that tells the client what nodes are available |
ConnectionConfiguration(IConnectionPool, IConnection)
Creates a new instance of ConnectionConfiguration
Declaration
public ConnectionConfiguration(IConnectionPool connectionPool, IConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnectionPool | connectionPool | A connection pool implementation that tells the client what nodes are available |
| IConnection | connection | An connection implementation that can make API requests |
ConnectionConfiguration(IConnectionPool, IConnection, IOpenSearchSerializer)
Creates a new instance of ConnectionConfiguration
Declaration
public ConnectionConfiguration(IConnectionPool connectionPool, IConnection connection, IOpenSearchSerializer serializer)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnectionPool | connectionPool | A connection pool implementation that tells the client what nodes are available |
| IConnection | connection | An connection implementation that can make API requests |
| IOpenSearchSerializer | serializer | A serializer implementation used to serialize requests and deserialize responses |
ConnectionConfiguration(IConnectionPool, IOpenSearchSerializer)
Creates a new instance of ConnectionConfiguration
Declaration
public ConnectionConfiguration(IConnectionPool connectionPool, IOpenSearchSerializer serializer)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnectionPool | connectionPool | A connection pool implementation that tells the client what nodes are available |
| IOpenSearchSerializer | serializer | A serializer implementation used to serialize requests and deserialize responses |
ConnectionConfiguration(string, ApiKeyAuthenticationCredentials)
Sets up the client to communicate to OpenSearch Cloud using cloudId,
CloudConnectionPool documentation for more information on how to obtain your Cloud Id
Declaration
public ConnectionConfiguration(string cloudId, ApiKeyAuthenticationCredentials credentials)
Parameters
| Type | Name | Description |
|---|---|---|
| string | cloudId | |
| ApiKeyAuthenticationCredentials | credentials |
ConnectionConfiguration(string, BasicAuthenticationCredentials)
Sets up the client to communicate to OpenSearch Cloud using cloudId,
CloudConnectionPool documentation for more information on how to obtain your Cloud Id
Declaration
public ConnectionConfiguration(string cloudId, BasicAuthenticationCredentials credentials)
Parameters
| Type | Name | Description |
|---|---|---|
| string | cloudId | |
| BasicAuthenticationCredentials | credentials |
ConnectionConfiguration(Uri, IConnection)
Creates a new instance of ConnectionConfiguration
Declaration
public ConnectionConfiguration(Uri uri = null, IConnection connection = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | The root of the OpenSearch node we want to connect to. Defaults to http://localhost:9200 |
| IConnection | connection | A connection implementation that can make API requests. Defaults to HttpConnection |
Fields
| Edit this page View SourceDefaultConnectionLimit
The default connection limit for both OpenSearch.Net and OpenSearch.Client. Defaults to 80
Except for HttpClientHandler implementations based on curl, which defaults to ProcessorCount
Declaration
public static readonly int DefaultConnectionLimit
Field Value
| Type | Description |
|---|---|
| int |
DefaultDnsRefreshTimeout
The default timeout before a TCP connection is forcefully recycled so that DNS updates come through Defaults to 5 minutes.
Declaration
public static readonly TimeSpan DefaultDnsRefreshTimeout
Field Value
| Type | Description |
|---|---|
| TimeSpan |
DefaultPingTimeout
The default ping timeout. Defaults to 2 seconds
Declaration
public static readonly TimeSpan DefaultPingTimeout
Field Value
| Type | Description |
|---|---|
| TimeSpan |
DefaultPingTimeoutOnSSL
The default ping timeout when the connection is over HTTPS. Defaults to 5 seconds
Declaration
public static readonly TimeSpan DefaultPingTimeoutOnSSL
Field Value
| Type | Description |
|---|---|
| TimeSpan |
DefaultTimeout
The default timeout before the client aborts a request to OpenSearch. Defaults to 1 minute
Declaration
public static readonly TimeSpan DefaultTimeout
Field Value
| Type | Description |
|---|---|
| TimeSpan |
DefaultUserAgent
The default user agent for OpenSearch.Net
Declaration
public static readonly string DefaultUserAgent
Field Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceUseSystemTextJson(bool)
Use the System.Text.Json-based low-level serializer instead of the default Utf8Json engine (GitHub issue
#388). This is the low-level programmatic opt-in; it takes precedence over the OSC_USE_STJ
environment variable and over any serializer passed to a constructor of this
class. Pass false to force the legacy Utf8Json engine.
This only applies to a standalone low-level OpenSearchLowLevelClient constructed directly
from a ConnectionConfiguration (as here). A low-level client obtained from a high-level one
via OpenSearchClient.LowLevel shares that client's ConnectionSettings and serializer, which
is governed by ConnectionSettings.UseSystemTextJson() instead — calling that method already
affects both the high-level and the shared low-level client, since they use the same underlying
RequestResponseSerializer.
Declaration
public ConnectionConfiguration UseSystemTextJson(bool useSystemTextJson = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | useSystemTextJson |
Returns
| Type | Description |
|---|---|
| ConnectionConfiguration |