OpenSearch class
The OpenSearch class stores the credentials and endpoint configuration used to create an OpenSearchClient object. It is thread-safe and can be shared across multiple threads without creating a new instance per request.
Method summary
| Method | Description |
|---|---|
OpenSearch(String accesskey, String secret, String host) | Creates an instance with credentials and an endpoint |
OpenSearch() | Creates an instance without parameters. Configure it later using setters |
setAccessKey(String accesskey) | Sets the AccessKey ID |
getAccessKey() | Returns the AccessKey ID |
setSecret(String secret) | Sets the AccessKey secret |
getSecret() | Returns the AccessKey secret |
setHost(String host) | Sets the API endpoint |
getHost() | Returns the API endpoint |
setOptions(Map<String,String> options) | Sets additional options |
getOptions() | Returns the configured options |
Constructors
OpenSearch(String accesskey, String secret, String host)
Creates an OpenSearch instance with credentials and an endpoint in a single call. Use this constructor when all configuration values are available upfront.
Parameters
| Parameter | Type | Description |
|---|---|---|
accesskey | String | Your Alibaba Cloud AccessKey ID. You can obtain the AccessKey ID from the Alibaba Cloud Management Console. |
secret | String | Your Alibaba Cloud AccessKey secret. You can obtain the AccessKey secret from the Alibaba Cloud Management Console. |
host | String | The OpenSearch API endpoint for your region. |
OpenSearch()
Creates an OpenSearch instance with no parameters. Use this constructor when you need to configure credentials and the endpoint separately using setAccessKey(), setSecret(), and setHost().
Methods
setAccessKey
Sets the AccessKey ID.
OpenSearch setAccessKey(String accesskey)Parameters
| Parameter | Type | Description |
|---|---|---|
accesskey | String | Your Alibaba Cloud AccessKey ID. You can obtain the AccessKey ID from the Alibaba Cloud Management Console. |
getAccessKey
Returns the configured AccessKey ID.
String getAccessKey()Return value
The AccessKey ID. Type: String.
setSecret
Sets the AccessKey secret.
OpenSearch setSecret(String secret)Parameters
| Parameter | Type | Description |
|---|---|---|
secret | String | Your Alibaba Cloud AccessKey secret. You can obtain the AccessKey secret from the Alibaba Cloud Management Console. |
getSecret
Returns the configured AccessKey secret.
String getSecret()Return value
The AccessKey secret. Type: String.
setHost
Sets the OpenSearch API endpoint.
OpenSearch setHost(String host)Parameters
| Parameter | Type | Description |
|---|---|---|
host | String | The OpenSearch API endpoint for your region. |
getHost
Returns the configured OpenSearch API endpoint.
String getHost()Return value
The API endpoint. Type: String.
setOptions
Sets additional options.
OpenSearch setOptions(Map<String,String> options)Parameters
| Parameter | Type | Description |
|---|---|---|
options | Map<String,String> | The options to configure. |
getOptions
Returns the configured options.
Map<String,String> getOptions()Return value
The configured options. Type: Map<String,String>.