OpenSearch

更新时间:
复制 MD 格式

The OpenSearch class holds the connection configuration — AccessKey ID, AccessKey secret, and API endpoint — used to create an OpenSearchClient object. It is thread-safe: create one instance at application startup and reuse it across threads.

Method summary

MethodSignatureDescription
Constructor (parameterized)OpenSearch(String accesskey, String secret, String host)Creates an instance with an AccessKey pair and API endpoint
Constructor (no-arg)OpenSearch()Creates an instance with no initial configuration
setAccessKeyOpenSearch setAccessKey(String accesskey)Sets the AccessKey ID
getAccessKeyString getAccessKey()Returns the AccessKey ID
setSecretOpenSearch setSecret(String secret)Sets the AccessKey secret
getSecretString getSecret()Returns the AccessKey secret
setHostOpenSearch setHost(String host)Sets the API endpoint
getHostString getHost()Returns the API endpoint
setOptionsOpenSearch setOptions(Map<String, String> options)Sets additional options
getOptionsMap<String, String> getOptions()Returns the configured options

Constructors

Constructor (parameterized)

OpenSearch(String accesskey, String secret, String host)

Creates an OpenSearch instance with an AccessKey pair and API endpoint. Use this constructor when you have credentials ready at initialization time.

ParameterTypeDescription
accesskeyStringYour AccessKey ID. Retrieve it from the Alibaba Cloud Management Console.
secretStringYour AccessKey secret. Retrieve it from the Alibaba Cloud Management Console.
hostStringThe OpenSearch API endpoint for your region.

Constructor (no-arg)

OpenSearch()

Creates an OpenSearch instance with no initial configuration. Use the setter methods to supply credentials and the endpoint before creating a client.

Methods

setAccessKey

OpenSearch setAccessKey(String accesskey)

Sets the AccessKey ID.

ParameterTypeDescription
accesskeyStringYour AccessKey ID. Retrieve it from the Alibaba Cloud Management Console.

Return value: The OpenSearch instance.

getAccessKey

String getAccessKey()

Returns the configured AccessKey ID.

Return value: The AccessKey ID. Type: String.

setSecret

OpenSearch setSecret(String secret)

Sets the AccessKey secret.

ParameterTypeDescription
secretStringYour AccessKey secret. Retrieve it from the Alibaba Cloud Management Console.

Return value: The OpenSearch instance.

getSecret

String getSecret()

Returns the configured AccessKey secret.

Return value: The AccessKey secret. Type: String.

setHost

OpenSearch setHost(String host)

Sets the OpenSearch API endpoint for your region.

ParameterTypeDescription
hostStringThe OpenSearch API endpoint for your region.

Return value: The OpenSearch instance.

getHost

String getHost()

Returns the configured API endpoint.

Return value: The API endpoint. Type: String.

setOptions

OpenSearch setOptions(Map<String, String> options)

Sets additional options.

ParameterTypeDescription
optionsMap<String, String>A map of option key-value pairs.

Return value: The OpenSearch instance.

getOptions

Map<String, String> getOptions()

Returns the configured options.

Return value: The options map. Type: Map<String, String>.