This topic describes how to configure access credentials (accounts, whitelist, and public network) for a PolarDB-X intelligent search engine instance, and how to connect to search nodes through the REST API, official clients, or OpenSearch Dashboards.
Configure the whitelist
Before you access a search node, add the IP address of your business environment to the whitelist.
-
On the Access Configuration tab, locate the Whitelist section.
-
Click the Add Whitelist Group button and provide the following information in the dialog box:
-
Group Name: used to distinguish different sources (for example, office or app-prod).
-
Group Whitelist: the allowed IP addresses or CIDR blocks. Separate multiple entries with commas (,).
-
-
After submission, a new row appears in the whitelist showing Name, IP, and Actions (Edit / Delete).
Always configure the whitelist for public network access to prevent unauthorized access.
Configure access accounts
REST API access requires a basic authentication username and password. Manage accounts in the Account Management section.
Create an account
-
Click the Create Account button.
-
Fill in the form:
-
Account Name: the account name (a combination of letters and digits).
-
Password: the password must be 8 to 32 characters long and must contain at least 3 of the following character types: uppercase letters, lowercase letters, digits, and special characters. The password must not contain consecutive characters (for example,
123orabc) or common weak patterns. -
Confirm Password: enter the password again to confirm.
-
-
After submission, the account can be used for REST API authentication.
Reset password
In the account list, click Reset Password in the row of the target account, enter a value for New Password that meets the password complexity requirements, and submit.
Delete an account
In the account list, click Delete in the row of the target account. After confirmation, the account is removed from the access credentials.
View connection information
The Connection Information section shows the following endpoint information:
|
Field |
Description |
|
Internal Address |
The private domain name used to access the REST API from within a VPC. |
|
Internal Port |
The private REST API port (fixed to 9200). |
|
Public Endpoint |
The public domain name. You must enable public network access first. |
|
Public Port |
The public REST API port (fixed to 9200). |
|
Dashboard Internal Address |
The private address for OpenSearch Dashboards. |
|
Dashboard Internal Port |
The private port for OpenSearch Dashboards. |
|
Dashboard Public Address |
The public address for OpenSearch Dashboards. |
|
Dashboard Public Port |
The public port for OpenSearch Dashboards. |
|
Use HTTPS Protocol |
Determine whether to enable HTTPS based on your business requirements. HTTP is used by default. |
Enable or disable public network access
Public network access is Not Enabled by default. When you need it, click Enable Now to obtain a public domain name. After it is enabled, you can click Disable Public Network to disable public network access.
Public network access exposes the instance to the internet. Always maintain both the whitelist and strong-password accounts.
Connect from the command line (curl)
Basic connection check
# Cluster health status
curl -XGET "http://<API endpoint>:<port>/_cluster/health?pretty" -u "<username>:<password>"
# Node information
curl -XGET "http://<API endpoint>:<port>/_cat/nodes?v" -u "<username>:<password>"
# Index list
curl -XGET "http://<API endpoint>:<port>/_cat/indices?v" -u "<username>:<password>"
Common management commands
# Cluster settings
curl -XGET "http://<API endpoint>:<port>/_cluster/settings?include_defaults=true&pretty" -u "<username>:<password>"
# Index details
curl -XGET "http://<API endpoint>:<port>/<index name>?pretty" -u "<username>:<password>"
# Node resource usage
curl -XGET "http://<API endpoint>:<port>/_cat/nodes?v&h=name,heap.percent,ram.percent,cpu,disk.used_percent" \
-u "<username>:<password>"
OpenSearch official clients
Intelligent search instances are fully compatible with OpenSearch official clients:
|
Language |
Client |
Reference |
|
Java |
opensearch-java |
|
|
Python |
opensearch-py |
https://opensearch.org/docs/latest/clients/python-low-level/ |
|
Go |
opensearch-go |
|
|
Node.js |
opensearch-js |
https://opensearch.org/docs/latest/clients/javascript/index/ |
|
.NET / Ruby / Rust / PHP |
opensearch-net / -ruby / -rs / -php |
Connection configuration essentials:
-
Host: the private or public address from the connection information.
-
Port: the port shown in the console (9200 by default).
-
Protocol: determine whether to enable HTTPS based on your business requirements. HTTP is used by default.
-
Authentication: basic authentication (username and password, created through account management).
OpenSearch Dashboards
Dashboards is the visual management console built into OpenSearch. It provides:
-
Dev Tools: an interactive query console for debugging REST API requests.
-
Discover: browse and search data in indexes.
-
Visualize: create data visualization charts.
-
Dashboard: combine multiple visualizations into a dashboard.
Access method
-
In the Connection Information section, obtain the private or public Dashboards address.
-
Open the address in a browser and log on with the username and password that you created in account management.
Run queries with Dev Tools
GET _cluster/health
PUT /test-index
{ "settings": { "number_of_shards": 1 } }
POST /test-index/_search
{ "query": { "match_all": {} } }
Connection troubleshooting
|
Issue |
Possible cause |
Solution |
|
Connection refused |
Port not reachable or public network not enabled |
|
|
Connection timeout |
Network unreachable or VPC routing not connected |
Make sure the client and the instance are in the same VPC, or connect over the public network. |
|
401 Unauthorized |
Authentication failed |
Check whether the basic authentication username and password are correct, and whether any special characters in the password need to be escaped. |