All Products
Search
Document Center

OpenSearch:OpenSearch

Last Updated:Oct 10, 2023

Overview

This topic describes the OpenSearch class and its methods. This class is used to create OpenSearchClient objects.

Class security

Thread-safe

Constructor (1)

This constructor requires you to specify an AccessKey pair and the endpoint of the OpenSearch API.
OpenSearch(String accesskey, String secret, String host)

Parameter description

Parameter

Type

Description

accesskey

String

The AccessKey ID of your Alibaba Cloud account. You can obtain the AccessKey ID from the Alibaba Cloud Management Console.

secret

String

The AccessKey secret of your Alibaba Cloud account. You can obtain the AccessKey secret from the Alibaba Cloud Management Console.

host

String

The endpoint of the OpenSearch API in your region.

Constructor (2)

This constructor requires no parameter.
OpenSearch()

setAccessKey

Method definition

Specifies the AccessKey ID of your Alibaba Cloud account.
OpenSearch    setAccessKey(String accesskey)

Parameter description

Parameter

Type

Description

accesskey

String

The AccessKey ID of your Alibaba Cloud account. You can obtain the AccessKey ID from the Alibaba Cloud Management Console.


getAccessKey

Method definition

Obtain the specified AccessKey ID.
String    getAccessKey()

Return value

  • The specified AccessKey ID. Type: String.


setSecret

Method definition

Specifies the AccessKey secret of your Alibaba Cloud account.
OpenSearch    setSecret(String secret)

Parameter description

Parameter

Type

Description

secret

String

The AccessKey secret of your Alibaba Cloud account. You can obtain the AccessKey secret from the Alibaba Cloud Management Console.


getSecret

Method definition

Obtain the specified AccessKey secret.
String    getSecret()

Return value

  • The specified AccessKey secret. Type: String.


setHost

Method definition

Specifies the endpoint of the OpenSearch API in your region.
OpenSearch    setHost(String host)

Parameter description

Parameter

Type

Description

host

String

The endpoint of the OpenSearch API in your region.


getHost

Method definition

Obtain the specified endpoint of the OpenSearch API in your region.
String    getHost()

Return value

  • The specified endpoint of the OpenSearch API in your region. Type: String.


setOptions

Method definition

Specifies options.
OpenSearch    setOptions(Map<String,String> options)

Parameter description

Parameter

Type

Description

options

Map<String,String>

The options you want to specify, in the Map type.


getOptions

Method definition

Obtains the options that are specified.
Map<String,String>    getOptions()

Return value

  • The options that are specified. Type: Map<String,String>.