Couchbase Search Advanced API
- reference
Overview
The Advanced Search REST APIs are provided by the Search service. These APIs enable you to manage and query Search index partitions and to specify advanced settings.
Version information
Version : 7.6
Host information
{scheme}://{host}:{port}
The URL scheme, host, and port are as follows.
Component | Description |
---|---|
scheme |
The URL scheme. Use Values: |
host |
The host name or IP address of a node running the Search Service. Example: |
port |
The Search Service REST port. Use Values: |
Resources
This section describes the operations available with this REST API. The operations are grouped in the following categories.
Definition
Operations for Search index partition definition.
Get Index Partition Information
GET /api/pindex
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
A JSON object containing the Search index partition information. |
Example HTTP Response
{
"pindexes": {
"myFirstIndex_6cc599ab7a85bf3b_0": {
"indexName": "myFirstIndex",
"indexParams": "",
"indexType": "blackhole",
"indexUUID": "6cc599ab7a85bf3b",
"name": "myFirstIndex_6cc599ab7a85bf3b_0",
"sourceName": "",
"sourceParams": "",
"sourcePartitions": "",
"sourceType": "nil",
"sourceUUID": "",
"uuid": "2d9ecb8b574a9f6a"
}
},
"status": "ok"
}
Query
Operations for querying Search index partitions.
Get Index Partition Document Count
GET /api/pindex/{pindexName}/count
Parameters
Name | Description | Schema |
---|---|---|
pindexName |
The name of the Search index partition. |
String |
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
The Search Service returns a response that includes the status |
Query Index Partition
POST /api/pindex/{pindexName}/query
Description
Execute a query against a specific Search index partition by name.
-
application/json
-
application/json
Parameters
Name | Description | Schema |
---|---|---|
pindexName |
The name of the Search index partition. |
String |
Name | Description | Schema |
---|---|---|
Body |
A JSON object to define the settings for your Search query. For more information about how to create a Search query JSON object, see Search Request JSON Properties. |
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
The response object has a status section that must be checked for every request. Under nearly all circumstances, the query response will be HTTP 200 even though individual index shards (partitions) may encounter a timeout or return an error. |
Quota
Operations for managing Search memory quota.
Set Search Memory Quota
POST /pools/default
Description
Sets the memory quota for the Search Service.
-
application/x-www-form-urlencoded
Parameters
Name | Description | Schema |
---|---|---|
ftsMemoryQuota |
The memory quota for the Search service. |
Integer |
Definitions
This section describes the properties consumed and returned by this REST API.
Document Count
Index Partitions
Index Partitions Wrapper
Index Partition
Query Request
Query Response
Document Count
Property | Schema | |
---|---|---|
status |
The status of the operation. |
String |
count |
The document count for the specified index. |
Integer |
Index Partitions
Property | Schema | |
---|---|---|
pindexes |
An object containing information about 1 or more Search index partitions. |
|
status |
The status of the request. |
String |
Index Partitions Wrapper
Property | Schema | |
---|---|---|
additional |
An object containing information about a single Search index partition. The name of the property is the name of the Search index partition. |
Index Partition
Property | Schema | |
---|---|---|
indexName |
The name of the Search index. For more information, see Initial Settings. |
String |
indexParams |
The Search index's type identifier, type mappings, and analyzers. For more information, see Params Object. |
Object |
indexType |
The type of the Search index. For more information, see Initial Settings. |
String |
indexUUID |
The UUID of the Search index. For more information, see Initial Settings. |
String |
name |
The name of the Search index partition. |
String |
sourceName |
The name of the bucket where the Search index is stored. For more information, see Initial Settings. |
String |
sourceParams |
Advanced settings for Search index behavior. For more information, see Initial Settings. |
Object |
sourcePartitions |
String |
|
sourceType |
The type of the bucket where the Search index is stored. For more information, see Initial Settings. |
String |
sourceUUID |
The UUID of the bucket where the Search index is stored. For more information, see Initial Settings. |
String |
uuid |
The UUID of the Search index partition. |
String |
Query Request
Property | Schema | |
---|---|---|
query |
An object that contains the properties for one of the supported query types. For more information, see Query Object. |
Object |
knn |
An array that contains objects that describe a Vector Search query. For more information, see Knn Objects. |
Object array |
ctl |
An object that contains properties for query consistency. For more information, see Ctl Object. |
Object |
size |
Set the total number of results to return for a single page of search results. |
Integer |
from |
Set an offset value to change where pagination starts for search results. |
Integer |
highlight |
Contains properties to control search result highlighting. For more information, see Highlight Objects. |
Object |
fields |
An array of strings to specify each indexed field you want to return in search results. |
String array |
facets |
Contains nested objects to define each facet you want to return with search results. For more information, see Facet Objects. |
Object |
explain |
Whether to create an explanation for a search result's score in search results. |
Boolean |
sort |
Contains an array of strings or JSON objects to set how to sort search results. For more information, see Sort Object. |
Any Type array |
includeLocations |
Whether to return the position of each occurrence of a search term inside a document. |
Boolean |
score |
Whether to include document relevancy scoring in search results. |
String |
search_after |
Use to control pagination in search results. |
String array |
search_before |
Use to control pagination in search results. |
String array |
collections |
An array of strings that specify the collections where you want to run the query. |
String array |
Security
The Search REST APIs support HTTP basic authentication. Pass your credentials through HTTP headers.
Manage
You must have the Search Admin role, with FTS Manage permissions on the required bucket.
Type : http
Read
You must have the Search Reader or Search Admin role, with FTS Read permissions on the required bucket.
Type : http
Write
You must have the Search Admin role, with FTS Write permissions on the required bucket.
Type : http
For more information, see Roles.