Lindorm Search Engine provides a graphical user interface (GUI), which you can use to send RESTful API requests to access Lindorm Search Engine. This topic describes how to use the Lindorm console to log in to the UI and execute read and write requests.
Prerequisites
The service type of your instance is Lindorm V1 or Lindorm. To learn how to view the service type, see View the product series.
LindormSearch is activated. For more information, see Activation guide.
Your client's IP address is in the Lindorm whitelist. For more information, see Configure a whitelist.
ImportantIf your client uses IPv6 by default, disable it. Otherwise, the whitelist verification fails.
Procedure
Log on to the GUI
Log on to the Lindorm console.
In the upper-left corner of the page, select the region where your instance is located.
On the Instances page, click the ID of the target instance or click View Instance Details in the Actions column.
In the left-side navigation pane, click Search Engine.
In the UI Access section, click Internet or VPC to log on to the cluster management system.
On the logon page, enter the Default Username and Default Initial Password that are displayed in the UI Access section.
NoteThe first time you access the UI, it may take a few moments for the page resources to load.
For your first login, you must use the Default Username and Default Initial Password to log in to the Search UI. For subsequent logins, you can use other users created by the default user to log in to the Cluster Management UI. For more information about user management, see User and Permission Management.
Read and write operations
The syntax for read and write operations is compatible with Elasticsearch (ES) API 7.x.
Dev tools
Click the
icon in the upper-left corner to open the sidebar, and then click .In Dev Tools, you can send RESTful API requests to LindormSearch.
View all created indexes
Use the cat API to view basic information about all indexes in LindormSearch.
Add the v parameter to the request path to display the column headers in the response.
GET /_cat/indices?vThe following response is returned:
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open test2 test2 2 0 0 0 416b 416b
green open test3 test3 2 0 1 0 16.8kb 16.8kb
green open test1 test1 1 0 0 0 208b 208b
green open .kibana_1 .kibana_1 1 0 1 0 5.1kb 5.1kbCreate an index
Use the Create index API to add a new index.
In the request body, you can specify the settings and mappings for the index.
settings: The configuration of the index. For example, you can specify the number of shards (index.number_of_shards) and the refresh interval (index.refresh_interval), which is the maximum time from when a document is indexed until it becomes searchable.mappings: The schema of the index. For example, you can define the fields and their data types.PUT /test { "settings": { "index.number_of_shards": 2, "index.refresh_interval": "10s" }, "mappings": { "properties": { "firstName": { "type": "keyword" }, "lastName": { "type": "keyword" } } } }The following response is returned:
{ "acknowledged": true, "shards_acknowledged": true, "index": "test" }
View a specific index
Use the Get index API to view an index's
settingsandmappings.GET /testThe following response is returned:
{ "test": { "aliases": {}, "mappings": { "properties": { "firstName": { "type": "keyword" }, "lastName": { "type": "keyword" } } }, "settings": { "index": { "search": { "slowlog": { "level": "DEBUG", "threshold": { "fetch": { "warn": "1s", "trace": "200ms", "debug": "500ms", "info": "800ms" }, "query": { "warn": "10s", "trace": "500ms", "debug": "1s", "info": "5s" } } } }, "refresh_interval": "10s", "indexing": { "slowlog": { "level": "DEBUG", "threshold": { "index": { "warn": "10s", "trace": "500ms", "debug": "2s", "info": "5s" } } } }, "number_of_shards": "2", "provided_name": "test4", "creation_date": "1722418296110", "number_of_replicas": "0", "uuid": "test4", "version": { "created": "136287927" } } } } }To view only the
settingsormappings, you can use the Get index settings API or the Get mapping API.The following example shows how to retrieve the
settingsof an index.GET /test/_settingsThe following response is returned:
{ "test": { "settings": { "index": { "search": { "slowlog": { "level": "DEBUG", "threshold": { "fetch": { "warn": "1s", "trace": "200ms", "debug": "500ms", "info": "800ms" }, "query": { "warn": "10s", "trace": "500ms", "debug": "1s", "info": "5s" } } } }, "refresh_interval": "10s", "indexing": { "slowlog": { "level": "DEBUG", "threshold": { "index": { "warn": "10s", "trace": "500ms", "debug": "2s", "info": "5s" } } } }, "number_of_shards": "2", "provided_name": "test4", "creation_date": "1722418296110", "number_of_replicas": "0", "uuid": "test4", "version": { "created": "136287927" } } } } }
Update index settings
Use the Update index settings API to update an index's dynamic settings.
The following example shows how to change the index.refresh_interval setting to 1s. This changes the time from when a document is indexed until it becomes searchable to 1 second. The minimum interval is 1 second.
PUT /test/_settings
{
"index": {
"refresh_interval": "1s"
}
}The following response is returned:
{
"acknowledged": true
}Write data to an index
Use the Index API to add or update documents in an index.
When you use the
PUTmethod, you must explicitly specify anid. If the specifiedidalready exists in the index, the new document overwrites the existing one.The following example sets the
idto1:PUT /test/_doc/1 { "firstName": "John", "lastName": "Smith" }The following response is returned:
{ "_index": "test", "_type": "_doc", "_id": "1", "_version": 1, "result": "created", "_shards": { "total": 1, "successful": 1, "failed": 0 }, "_seq_no": 0, "_primary_term": 1 }When you use the
POSTmethod, you can omit theid. LindormSearch automatically generates anidfor the document.POST /test/_doc { "firstName": "Frank", "lastName": "Brown" }The following response is returned:
{ "_index": "test", "_type": "_doc", "_id": "b_MsCJEB3g4To6JSOeF6", "_version": 1, "result": "created", "_shards": { "total": 1, "successful": 1, "failed": 0 }, "_seq_no": 0, "_primary_term": 1 }LindormSearch automatically generates the
idb_MsCJEB3g4To6JSOeF6for the document.Use the Update API to update specific fields of an existing document. The document
idmust be included in the request path, and the request body must contain thedocobject.The following example updates the
firstNamefield toLanefor the document with theid1:POST /test/_update/1 { "doc": { "firstName": "Lane" } }The following response is returned:
{ "_index": "test", "_type": "_doc", "_id": "1", "_version": 2, "result": "updated", "_shards": { "total": 1, "successful": 1, "failed": 0 }, "_seq_no": 1, "_primary_term": 1 }
Query data in an index
Use the Search API to query data in an index by specifying the query criteria in the request body.
The following example searches for documents where the
lastNameisSmith:GET /test/_search { "query": { "match": { "lastName": "Smith" } } }The following response is returned:
{ "took": 4, "timed_out": false, "_shards": { "total": 2, "successful": 2, "skipped": 0, "failed": 0 }, "hits": { "total": { "value": 1, "relation": "eq" }, "max_score": 0.18232156, "hits": [ { "_index": "test", "_id": "1", "_score": 0.18232156, "_source": { "firstName": "Lane", "lastName": "Smith" } } ] } }Use the Get API to retrieve a document by its
id.The following example retrieves the document with the
id1:GET /test/_doc/1The following response is returned:
{ "_index": "test", "_id": "1", "_version": 2, "_seq_no": 1, "_primary_term": 1, "found": true, "_source": { "firstName": "Lane", "lastName": "Smith" } }
Delete data from an index
The Delete API deletes a document from an index by its id.
The following example deletes the document with the id 1:
DELETE /test/_doc/1The following response is returned:
{
"_index": "test",
"_type": "_doc",
"_id": "1",
"_version": 3,
"result": "deleted",
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"_seq_no": 2,
"_primary_term": 1
}In the response, "successful": 1 indicates that the document was deleted.