Search Index JSON Properties
- reference
Use a JSON payload to control the settings for a Search index.
When you create a Search index with the REST API, you must give a JSON payload with the settings for the new Search index.
Your JSON payload must contain the properties described in Initial Settings, including the Params Object.
Initial Settings
The start of the JSON payload for a Search index contains important settings for your index:
{
"name": "travel-sample._default.gfx",
"type": "fulltext-index",
"uuid": "28b999e9e17dd4a7",
"sourceType": "gocbcore",
"sourceName": "travel-sample",
"sourceUUID": "d3604c0ec4792b4c6c5f7f2cc8207b80",
"sourceParams": {},
"planParams": {
"maxPartitionsPerPIndex": 1024,
"indexPartitions": 1,
"numReplicas": 0
},
"params": {
| To view the entire JSON payload, click View. |
When you Create a Search Index Alias with the REST API, the properties in this section are the only properties you need to include in your alias definition.
All Search index payloads have the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
name |
String |
Yes |
The name of the Search index or index alias. For Couchbase Server version 7.6 and later, your index name must be unique inside your selected bucket and scope. You cannot have 2 indexes with the same name inside the same bucket and scope. For index aliases, names must be unique within the same bucket and scope if you’re using the scoped endpoint. Global index aliases must not share a name with another alias. For more information about Search index aliases, see Create Search Index Aliases. |
type |
String |
Yes |
The type of index you want to create:
|
String |
No |
The UUID for the Search index or index alias. The Search Service automatically generates a UUID for a Search index or index alias. If you use an existing UUID, the Search Service updates the existing Search index or index alias.
Do not include the View the UUID for an existing index from the Couchbase Server Web Console by selecting an existing index, and clicking Edit Index. The UUID displays in the Index Definition Preview on the Edit Index page. You can also use the Index Definition endpoints provided by the Search REST API. |
|
sourceType |
String |
Yes |
When you create a Search index, the When you create an index alias, the |
sourceName |
String |
Yes |
The name of the bucket where you want to create the Search index. You do not need to include a value for this parameter when creating an index alias. |
String |
No |
The UUID of the bucket where you want to create the Search index. The Search Service automatically finds the UUID for the bucket. Do not include the You do not need to include a value for this parameter when creating an index alias. |
|
sourceParams |
Object |
No |
This object contains advanced settings for index behavior. Do not add content into this object unless instructed by Couchbase Support. |
planParams |
Object |
Yes |
An object that sets the Search index’s partitions and replications. For more information, see planParams Object. For an index alias, set this to an empty object. |
params |
Object |
Yes |
An object that sets the Search index’s type identifier, type mappings, and analyzers. For an index alias, this sets the target Search indexes to include in the alias. For more information, see Params Object. |
store |
Object |
No |
An object that controls merge policy, concurrent persister behavior, and file format version for the Search index. The Search Service can automatically set these to reasonable default values, based on the other settings in your Search index definition. For more information, see Store Object. |
planParams Object
The planParams object sets a Search index’s partition and replication settings:
"planParams": {
"maxPartitionsPerPIndex": 1024,
"indexPartitions": 1,
"numReplicas": 0
},
| To view the entire JSON payload, click View. |
The planParams object contains the following properties:
| Property | Type | Required? | Description | ||
|---|---|---|---|---|---|
maxPartitionsPerPIndex |
n/a |
No |
This setting is deprecated. Use |
||
indexPartitions |
Integer |
Yes |
The number of partitions to split the Search index into, across the nodes you have available in your cluster with the Search Service enabled. Use index partitions to increase index and query performance on large datasets.
|
||
numReplicas |
Integer |
Yes |
For high-availability, set the number of replicas the Search Service creates for the Search index. You can create up to three replicas for a Search index.
Each replica creates a full copy of the Search index to increase high-availability.
To turn off replication for the Search index, set The number of replicas you can create depends on the number of nodes you have available with the Search Service enabled. |
Params Object
The params object sets a Search index’s type identifier, type mappings, and analyzers.
It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
doc_config |
Object |
Yes |
An object that sets how the Search index sets a document’s type. For more information, see Doc_config Object. |
mapping |
Object |
Yes |
An object that sets the analyzers and type mappings for a Search index. For more information, see Mapping Object. |
targets |
Object |
Index Alias Only |
When creating an index alias, an object that lists each Search index you want to include in the alias. The For example:
For more information about creating aliases, see Create a Search Index Alias with the Web Console or Create a Search Index Alias with the REST API. |
Doc_config Object
The doc_config object sets how the Search index sets a document’s type:
"doc_config": {
"docid_prefix_delim": "",
"docid_regexp": "",
"mode": "scope.collection.custom",
"type_field": "type",
"doc_filter": {
"free_breakfast_true": {
"bool": true,
"field": "free_breakfast",
"order": 1
},
"review_date_range": {
"start": "2015-01-01",
"end": "2019-01-01",
"inclusive_end": true,
"inclusive_start": false,
"field": "reviews.date",
"order": 2,
"datetime_parser": "My_Date_Time_Parser"
},
"cleanliness_range": {
"min": 3,
"max": 5,
"inclusive_min": true,
"inclusive_max": true,
"field": "reviews.ratings.Cleanliness",
"order": 3
},
"free_parking_AND_vacancy": {
"conjuncts": [
{
"bool": true,
"field": "vacancy"
},
{
"bool": true,
"field": "free_parking"
}
],
"order": 4
},
"location_OR_service": {
"disjuncts": [
{
"min": 5,
"field": "reviews.ratings.Service"
},
{
"min": 5,
"field": "reviews.ratings.Location"
}
],
"order": 6
},
"name_hotel": {
"term": "Hotel",
"order": 5,
"field": "name"
}
}
},
| To view the entire JSON payload, click View. |
The doc_config object is a child object of the Params Object. It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
mode |
String |
Yes |
Set a type identifier for the Search index to filter documents.
Set the mode for your type identifier by setting this property to
|
docid_prefix_delim |
String |
Yes |
If For example, to filter documents based on the characters before a To use this filter later, you need to modify the name of the type mapping where you want to use the filter. For example, you could set a specific filter value of |
docid_regexp |
String |
Yes |
If For example, to filter documents that contain the characters To use this filter later, you need to modify the name of the type mapping where you want to use the filter. For example, you could set a specific filter value of |
type_field |
String |
Yes |
If For example, to filter documents based on the value of their To use this filter later, you need to modify the name of the type mapping where you want to use the filter. For example, you could use a field called |
Object |
Yes |
Couchbase Server 8.0 If You can filter documents with custom filters based on the value of: You can add up to a maximum of 100 document filters on a single Search index. For more information about how to define each type of filter in your Search index definition, see Doc_filter Object. |
Doc_filter Object
Couchbase Server 8.0
The doc_filter object contains JSON objects for each document filter you want to apply to a type mapping in your Search index:
"doc_filter": {
"free_breakfast_true": {
"bool": true,
"field": "free_breakfast",
"order": 1
},
"review_date_range": {
"start": "2015-01-01",
"end": "2019-01-01",
"inclusive_end": true,
"inclusive_start": false,
"field": "reviews.date",
"order": 2,
"datetime_parser": "My_Date_Time_Parser"
},
"cleanliness_range": {
"min": 3,
"max": 5,
"inclusive_min": true,
"inclusive_max": true,
"field": "reviews.ratings.Cleanliness",
"order": 3
},
"free_parking_AND_vacancy": {
"conjuncts": [
{
"bool": true,
"field": "vacancy"
},
{
"bool": true,
"field": "free_parking"
}
],
"order": 4
},
"location_OR_service": {
"disjuncts": [
{
"min": 5,
"field": "reviews.ratings.Service"
},
{
"min": 5,
"field": "reviews.ratings.Location"
}
],
"order": 6
},
"name_hotel": {
"term": "Hotel",
"order": 5,
"field": "name"
}
}
| To view the entire JSON payload, click View. |
You can add up to a maximum of 100 document filters on a single Search index.
You can define the following types of document filters:
Boolean Document Filters
Couchbase Server 8.0
A boolean document filter adds or removes documents from a type mapping based on the value of a boolean field:
"free_breakfast_true": {
"bool": true,
"field": "free_breakfast",
"order": 1
},
| To view the entire JSON payload, click View. |
Set the name of your boolean document filter object to the name you want for your filter.
Use this name to use the filter on a {scope}.{collection} object.
For example, {scope}.{collection}.free_breakfast_true.
A boolean document filter can have the following properties:
| Property | Type | Required? | Description | ||
|---|---|---|---|---|---|
bool |
Boolean |
Yes |
Set
|
||
field |
String |
Yes |
Enter the name of the field that contains a boolean value you want to use as a filter. |
||
order |
Number |
Yes |
Set the filtering order for this document filter, compared to the other document filters in use on the Search index. The Search Service applies document filters on type mappings in the order you specify.
For example, if a document does not pass a type mapping filter where The Search Service continues checking documents against any filters defined on type mappings in your Search index until a document passes a filter, or there are no more defined type mapping filters. If a document does not pass any defined filters, it’s not included in your Search index.
|
Date Range Document Filters
Couchbase Server 8.0
A date range document filter adds or removes documents from a type mapping based on the value of a date field and a specified range:
"review_date_range": {
"start": "2015-01-01",
"end": "2019-01-01",
"inclusive_end": true,
"inclusive_start": false,
"field": "reviews.date",
"order": 2,
"datetime_parser": "My_Date_Time_Parser"
},
| To view the entire JSON payload, click View. |
Set the name of your date range document filter object to the name you want for your filter.
Use this name to use the filter on a {scope}.{collection} object.
For example, {scope}.{collection}.review_date_range.
A date range document filter can have the following properties:
| Property | Type | Required? | Description | ||
|---|---|---|---|---|---|
start |
Date and Time String |
No |
Set the start date for the range you want to use as a filter.
Dates occurring before your You can choose to set only a By default, the value for |
||
end |
Date and Time String |
No |
Set the end date for the range you want to use as a filter.
Dates occurring after your You can choose to set only a By default, the value for |
||
inclusive_start |
Boolean |
No |
Set whether the value of
If you do not set a value for |
||
inclusive_end |
Boolean |
No |
Set whether the value of
If you do not set a value for |
||
field |
String |
Yes |
Enter the name of the field that contains a date value you want to use as a filter. |
||
order |
Number |
Yes |
Set the filtering order for this document filter, compared to the other document filters in use on the Search index. The Search Service applies document filters on type mappings in the order you specify.
For example, if a document does not pass a type mapping filter where The Search Service continues checking documents against any filters defined on type mappings in your Search index until a document passes a filter, or there are no more defined type mapping filters. If a document does not pass any defined filters, it’s not included in your Search index.
|
||
datetime_parser |
String |
No |
Enter the name of the date/time parser you want to use to interpret your date and time strings. You can use a default date/time parser or reference a date/time parser from the Date_time_parsers Object. |
Numeric Range Document Filters
Couchbase Server 8.0
A numeric range document filter adds or removes documents from a type mapping based on the value of a numeric field and a specified range:
"cleanliness_range": {
"min": 3,
"max": 5,
"inclusive_min": true,
"inclusive_max": true,
"field": "reviews.ratings.Cleanliness",
"order": 3
},
| To view the entire JSON payload, click View. |
Set the name of your numeric range document filter object to the name you want for your filter.
Use this name to use the filter on a {scope}.{collection} object.
For example, {scope}.{collection}.cleanliness_range.
A numeric range document filter can have the following properties:
| Property | Type | Required? | Description | ||
|---|---|---|---|---|---|
min |
Number |
No |
Set the minimum value for the range you want to use as a filter.
Values smaller than your You can choose to set only a By default, the value for |
||
max |
Number |
No |
Set the maximum value for the range you want to use as a filter.
Values larger than your You can choose to set only a By default, the value for |
||
inclusive_min |
Boolean |
No |
Set whether the value of
If you do not set a value for |
||
inclusive_max |
Boolean |
No |
Set whether the value of
If you do not set a value for |
||
field |
String |
Yes |
Enter the name of the field that contains a numeric value you want to use as a filter. |
||
order |
Number |
Yes |
Set the filtering order for this document filter, compared to the other document filters in use on the Search index. The Search Service applies document filters on type mappings in the order you specify.
For example, if a document does not pass a type mapping filter where The Search Service continues checking documents against any filters defined on type mappings in your Search index until a document passes a filter, or there are no more defined type mapping filters. If a document does not pass any defined filters, it’s not included in your Search index.
|
Term Document Filters
Couchbase Server 8.0
A term document filter adds or removes documents from a type mapping based on the existence of a term in a specified document field:
"name_hotel": {
"term": "Hotel",
"order": 5,
"field": "name"
}
| To view the entire JSON payload, click View. |
Set the name of your term document filter object to the name you want for your filter.
Use this name to use the filter on a {scope}.{collection} object.
For example, {scope}.{collection}.name_hotel.
A term document filter can have the following properties:
| Property | Type | Required? | Description | ||
|---|---|---|---|---|---|
term |
String |
Yes |
Enter a string that must exist inside The string must be an exact match for a document to pass. |
||
field |
String |
Yes |
Enter the name of the field where you want to search for the value of |
||
order |
Number |
Yes |
Set the filtering order for this document filter, compared to the other document filters in use on the Search index. The Search Service applies document filters on type mappings in the order you specify.
For example, if a document does not pass a type mapping filter where The Search Service continues checking documents against any filters defined on type mappings in your Search index until a document passes a filter, or there are no more defined type mapping filters. If a document does not pass any defined filters, it’s not included in your Search index.
|
Conjunct Document Filter
Couchbase Server 8.0
A conjunct document filter can contain any number of the other document filter types:
A document must pass every filter inside the conjuncts array to pass a conjunct document filter and be included in a type mapping:
"free_parking_AND_vacancy": {
"conjuncts": [
{
"bool": true,
"field": "vacancy"
},
{
"bool": true,
"field": "free_parking"
}
],
"order": 4
},
| To view the entire JSON payload, click View. |
Set the name of your conjunct document filter object to the name you want for your filter.
Use this name to use the filter on a {scope}.{collection} object.
For example, {scope}.{collection}.free_parking_AND_vacancy.
A conjunct document filter can have the following properties:
| Property | Type | Required? | Description | ||
|---|---|---|---|---|---|
conjuncts |
Array of Objects |
Yes |
Add an object to define each filter you want a document to pass before a document can be included in a type mapping. The |
||
order |
Number |
Yes |
Set the filtering order for this document filter, compared to the other document filters in use on the Search index. The Search Service applies document filters on type mappings in the order you specify.
For example, if a document does not pass a type mapping filter where The Search Service continues checking documents against any filters defined on type mappings in your Search index until a document passes a filter, or there are no more defined type mapping filters. If a document does not pass any defined filters, it’s not included in your Search index.
|
Disjunct Document Filter
Couchbase Server 8.0
A disjunct document filter can contain any number of the other document filter types:
A document must pass at least the number of filters you specify as min from the disjuncts array to pass the filter and be included in a type mapping:
"location_OR_service": {
"disjuncts": [
{
"min": 5,
"field": "reviews.ratings.Service"
},
{
"min": 5,
"field": "reviews.ratings.Location"
}
],
"order": 6
},
| To view the entire JSON payload, click View. |
Set the name of your disjunct document filter object to the name you want for your filter.
Use this name to use the filter on a {scope}.{collection} object.
For example, {scope}.{collection}.location_OR_service.
A disjunct document filter can have the following properties:
| Property | Type | Required? | Description | ||
|---|---|---|---|---|---|
disjuncts |
Array of Objects |
Yes |
Add an object to define each filter you want to run against a document for this disjunct document filter. The |
||
min |
Number |
Yes |
Set |
||
order |
Number |
Yes |
Set the filtering order for this document filter, compared to the other document filters in use on the Search index. The Search Service applies document filters on type mappings in the order you specify.
For example, if a document does not pass a type mapping filter where The Search Service continues checking documents against any filters defined on type mappings in your Search index until a document passes a filter, or there are no more defined type mapping filters. If a document does not pass any defined filters, it’s not included in your Search index.
|
Mapping Object
The mapping object contains a Search index’s analyzers and other advanced settings from the UI:
"mapping": {
"analysis": {
"analyzers": {
"My_Analyzer": {
"token_filters": [
"apostrophe",
"My_Token_Filter"
],
"char_filters": [
"asciifolding",
"html",
"My_Char_Filter"
],
"type": "custom",
"tokenizer": "My_Tokenizer_Excep"
}
},
"char_filters": {
"My_Char_Filter": {
"regexp": "[']",
"replace": " ",
"type": "regexp"
}
},
"tokenizers": {
"My_Tokenizer_Excep": {
"exceptions": [
"[*]"
],
"tokenizer": "unicode",
"type": "exception"
},
"My_Tokenizer_RegExp": {
"regexp": "[*]",
"type": "regexp"
}
},
"token_filters": {
"My_Token_Filter": {
"min": 3,
"max": 255,
"type": "length"
}
},
"token_maps": {
"My_Wordlist": {
"type": "custom",
"tokens": [
"the",
"is",
"and"
]
}
},
"date_time_parsers": {
"My_ISO_Date_Time_Parser": {
"type": "isostyle",
"layouts": [
"yyyy/MM/dd h:mma",
"dd/MM/yyyy HH:mm:ss",
"yyyy-MM-dd'T'HH:mm:ssXX",
"dd MMMM yy ha z",
"yyyy; MMM dd (EEE) hh:mm:ss.SSSSSaa xx"
]
},
"My_Percent_Date_Time_Parser": {
"type": "percentstyle",
"layouts": [
"%Y/%m/%d %l:%M%p",
"%d/%m/%Y %H:%M:%S",
"%Y-%m-%dT%H:%M:%S%z",
"%d %B %y %l%p %Z",
"%Y; %b %d (%a) %I:%M:%S.%N%P %z"
]
}
},
"synonym_sources": {
"synonyms_en": {
"analyzer": "My_Analyzer",
"collection": "synonyms_en"
}
}
},
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"default_mapping": {
"dynamic": false,
"enabled": false
},
"default_type": "_default",
"docvalues_dynamic": true,
"index_dynamic": true,
"scoring_model": "bm25",
"store_dynamic": true,
"type_field": "_type",
"types": {
| To view the entire JSON payload, click View. |
The mapping object is a child object of the Params Object. It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
Object |
Yes |
An object that contains the following child objects: |
|
default_analyzer |
String |
Yes |
The name of the default analyzer to use for the Search index. For more information about analyzers, see Analyzers. |
String |
Yes |
The name of the default date/time parser to use for the Search index. For more information about date/time parsers, see Date/Time Parsers. |
|
String |
Yes |
Set a name for the If you enable the include_in_all property for a child field, the contents of that child field can be searched without specifying a field name or by specifying the default field’s name in your Search query. |
|
default_mapping |
Object |
No |
An object that contains settings for the default type mapping on the Search index. The default type mapping contains all documents under the This type mapping is included for compatibility only. For more information about the properties inside the |
default_synonym_source |
String |
No |
Couchbase Server 8.0 The name of the default synonym source to use for the Search index. The value of For more information about using synonyms with the Search Service, see Add Synonyms to a Search Index. |
default_type |
String |
No |
This setting is included for compatibility with earlier indexes only. |
docvalues_dynamic |
Boolean |
Yes |
To include the value for each instance of an indexed field in the Search index to support facets and sorting search results, set To exclude the values for an indexed field in the index, set |
index_dynamic |
Boolean |
Yes |
To index any fields in the Search index where To exclude dynamic fields from the index, set |
scoring_model |
String |
Yes |
Couchbase Server 8.0 Choose the specific scoring model you want to use for scoring search results for this Search index:
For more information about the calculations for scoring for each algorithm, see Scoring for Search Queries. |
store_dynamic |
Boolean |
Yes |
To return the content from an indexed field in the Search index, set To exclude field content from the index, set |
type_field |
String |
No |
Use the same value assigned to the |
types |
Object |
No |
An object that contains any user-defined type mappings for the Search index, as For more information, see Types Object. |
Analyzers Object
The analyzers object contains any custom analyzers defined for a Search index.
"analyzers": {
"My_Analyzer": {
"token_filters": [
"apostrophe",
"My_Token_Filter"
],
"char_filters": [
"asciifolding",
"html",
"My_Char_Filter"
],
"type": "custom",
"tokenizer": "My_Tokenizer_Excep"
}
},
| To view the entire JSON payload, click View. |
The analyzers object is a child object of the analysis object. It contains any number of {analyzer_name} objects:
| Property | Type | Required? | Description |
|---|---|---|---|
{analyzer_name} |
Object |
Yes |
Set the name of this object to the name you want for your custom analyzer. You can reference the For more information about the properties in an |
{Analyzer_name} Object
The {analyzer_name} object defines a custom analyzer for a Search index:
"My_Analyzer": {
"token_filters": [
"apostrophe",
"My_Token_Filter"
],
"char_filters": [
"asciifolding",
"html",
"My_Char_Filter"
],
"type": "custom",
"tokenizer": "My_Tokenizer_Excep"
}
An {analyzer_name} object is a child object of the Analyzers Object. It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
token_filters |
Array |
Yes |
An array of strings that contains the token filters for the custom analyzer. For more information about the token filters you can define in a Search index JSON payload, see Token_filters Object. You can also use one of the default token filters. |
char_filters |
Array |
Yes |
An array of strings that contains the character filters for the custom analyzer. For more information about the character filters you can define in a Search index JSON payload, see Char_filters Object. You can also use one of the default character filters available. |
type |
String |
Yes |
The |
tokenizer |
String |
Yes |
The selected tokenizer for the custom analyzer. |
Char_filters Object
The char_filters object contains any custom character filters defined for a Search index:
"char_filters": {
"My_Char_Filter": {
"regexp": "[']",
"replace": " ",
"type": "regexp"
}
},
| To view the entire JSON payload, click View. |
The char_filters object is a child object of the analysis object. It contains any number of {char_filter_name} objects:
| Property | Type | Required? | Description |
|---|---|---|---|
{char_filter_name} |
Object |
Yes |
Set the name of this object to the name you want for your custom character filter. You can reference the For more information about the properties in an |
{Char_filter_name} Object
The {char_filter_name} object defines a specific custom character filter for a Search index:
"My_Char_Filter": {
"regexp": "[']",
"replace": " ",
"type": "regexp"
}
A {char_filter_name} object is a child object of the Char_filters Object.
It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
regexp |
String |
Yes |
The regular expression to use to filter characters from search queries and documents. |
replace |
String |
No |
The content to insert instead of the content in the |
type |
String |
Yes |
The |
Tokenizers Object
The tokenizers object contains any custom tokenizers defined for a Search index:
"tokenizers": {
"My_Tokenizer_Excep": {
"exceptions": [
"[*]"
],
"tokenizer": "unicode",
"type": "exception"
},
"My_Tokenizer_RegExp": {
"regexp": "[*]",
"type": "regexp"
}
},
| To view the entire JSON payload, click View. |
The tokenizers object is a child object of the analysis object.
It contains any number of {tokenizer_name objects}:
| Property | Type | Required? | Description |
|---|---|---|---|
{tokenizer_name} |
Object |
Yes |
Set the name of this object to the name you want for your custom tokenizer. You can reference the For more information about the properties in an |
{Tokenizer_name} Object
The {tokenizer_name} object defines a specific custom tokenizer for a Search index.
For example, the following My_Tokenizer_Excep object defines an exception tokenizer:
"My_Tokenizer_Excep": {
"exceptions": [
"[*]"
],
"tokenizer": "unicode",
"type": "exception"
},
A {tokenizer_name} object is a child object of the Tokenizers Object.
It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
exceptions |
Array |
Yes |
If the tokenizer’s For example, if you add the characters |
regexp |
String |
Yes |
If the tokenizer’s The tokenizer takes any matches for the regular expression from the input text stream and uses them as tokens. For example, if you use the regular expression |
tokenizer |
String |
Yes |
If the tokenizer’s You can choose a default tokenizer or use a tokenizer defined in the |
String |
Yes |
The tokenizer’s type. Can be one of:
|
Token_filters Object
The token_filters object contains any custom token filters defined for a Search index.
"token_filters": {
"My_Token_Filter": {
"min": 3,
"max": 255,
"type": "length"
}
},
| To view the entire JSON payload, click View. |
The token_filters object is a child object of the analysis object.
It contains any number of {token_filter_name} objects:
| Property | Type | Required? | Description |
|---|---|---|---|
{token_filter_name} |
Object |
Yes |
Set the name of this object to the name you want for your custom token filter. You can reference the For more information about the properties in an |
{Token_filter_name} Object
The {token_filter_name} object defines a custom token filter for a Search index.
For example, the following My_Token_Filter object defines a custom length token filter:
"My_Token_Filter": {
"min": 3,
"max": 255,
"type": "length"
}
A {token_filter_name} object is a child object of the Token_filters Object.
It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
type |
String |
Yes |
The token filter’s type. Can be one of:
|
Dict_compound Token Filters
A dict_compound token filter uses a wordlist to find subwords inside an input token.
If the token filter finds a subword inside a compound word, it turns it into a separate token.
"My_Dict_Compound_Filter": {
"dict_token_map": "articles_ca",
"type": "dict_compound"
},
For example, if you had a wordlist that contained play and jump, the token filter converts playful jumping into two tokens: play and jump.
| Property | Type | Required? | Description |
|---|---|---|---|
dict_token_map |
String |
Yes |
The wordlist to use to find subwords in existing tokens. You can use a default wordlist or one defined in the Token_maps Object. |
Edge_ngram Token Filters
An edge_ngram token filter uses a specified range to create new tokens.
You can also choose whether to create the new token from the start or backward from the end of the input token.
"My_Edge_ngram_Filter": {
"back": false,
"min": 4,
"max": 5,
"type": "edge_ngram"
},
For example, if you had a miminum of four and a maximum of five with an input token of breweries, the token filter creates the tokens brew and brewe.
| Property | Type | Required? | Description |
|---|---|---|---|
back |
Boolean |
Yes |
To create new tokens starting from the end and moving backward in an input token, set To create new tokens starting from the beginning and moving forward in an input token, set |
min |
Integer |
Yes |
Set the minimum character length for a new token. |
max |
Integer |
Yes |
Set the maximum character length for a new token. |
Elision Token Filters
An elision token filter removes elisions from input tokens.
"My_Elision_Filter": {
"articles_token_map": "stop_fr",
"type": "elision"
},
For example, if you had the stop_fr wordlist in an elision token filter, the token je m’appelle John becomes the tokens je, appelle, and John.
| Property | Type | Required? | Description |
|---|---|---|---|
articles_token_map |
String |
Yes |
The wordlist to use to find and remove elisions in existing tokens. You can use a default wordlist or one defined in the Token_maps Object. |
Keyword_marker Token Filters
A keyword_marker token filter finds keywords in an input token and turns them into tokens.
"My_Keyword_Marker_Filter": {
"keywords_token_map": "articles_ca",
"type": "keyword_marker"
},
For example, if you had a wordlist that contained the keyword beer, the token beer and breweries becomes the token beer.
| Property | Type | Required? | Description |
|---|---|---|---|
keywords_token_map |
String |
Yes |
The wordlist to use to find keywords in existing tokens. You can use a default wordlist or one defined in the Token_maps Object. |
Length Token Filters
A length token filter removes tokens that are shorter or longer than a set character length.
"My_Length_Filter": {
"min": 2,
"max": 4,
"type": "length"
},
For example, if you had a range with a minimum of two and a maximum of four, the token beer and breweries becomes the tokens beer and and.
| Property | Type | Required? | Description |
|---|---|---|---|
min |
Integer |
Yes |
The minimum character length for a new token from the token filter. |
max |
Integer |
Yes |
The maximum character length for a new token from the token filter. |
Ngram Token Filters
An ngram token filter uses a specified character length to split an input token into new tokens.
"My_Ngram_Filter": {
"min": 4,
"max": 5,
"type": "ngram"
},
For example, if you had a range with a minimum of four and a maximum of five, the token beers becomes the tokens beer, beers, and eers.
| Property | Type | Required? | Description |
|---|---|---|---|
min |
Integer |
Yes |
The minimum character length for a new token from the token filter. |
max |
Integer |
Yes |
The maximum character length for a new token from the token filter. |
Normalize_unicode Token Filters
A normalize_unicode token filter uses a specified Unicode Normalization form to create new tokens.
"My_Normalize_Unicode_Filter": {
"form": "nfkd",
"type": "normalize_unicode"
},
| Property | Type | Required? | Description |
|---|---|---|---|
form |
String |
Yes |
Select the form of Unicode Normalization to use on input tokens:
For more information about Unicode Normalization, see the Unicode Consortium’s Unicode Normalization Forms report. |
Shingle Token Filters
A shingle token filter uses a specified character length and separator to create new tokens.
"My_Shingle_Filter":{
"min": 2,
"max": 3,
"output_original": true,
"separator": " ",
"filler": "x",
"type": "shingle"
},
For example, if you use a whitespace tokenizer, a range with a minimum of two and a maximum of three, and a space as a separator, the token abc def becomes abc, def, and abc def.
| Property | Type | Required? | Description |
|---|---|---|---|
min |
Integer |
Yes |
The minimum character length for a new token before concatenation. |
max |
Integer |
Yes |
The maximum character length for a new token before concatenation. |
output_original |
Boolean |
Yes |
To add the original token to the token filter’s output, set To exclude the original token from the token filter’s output, set |
separator |
String |
No |
Set a |
filler |
String |
No |
If another token filter removes a token from the input for this token filter, set a |
Stop_tokens Token Filters
A stop_tokens token filter uses a wordlist to remove specific tokens from input.
"My_Stop_Tokens_Filter":{
"stop_token_map": "articles_ca",
"type": "stop_tokens"
},
For example, if you have a wordlist that contains the word and, the token beers and breweries becomes beers and breweries.
| Property | Type | Required? | Description |
|---|---|---|---|
stop_token_map |
String |
Yes |
The wordlist to use to filter tokens. The token filter removes any tokens from input that match an entry in the wordlist. You can use a default wordlist or one defined in the Token_maps Object. |
Truncate_token Token Filters
A truncate_token token filter uses a specified character length to shorten any input tokens that are too long.
"My_Truncate_Token_Filter":{
"length": 4,
"type": "truncate_token"
}
For example, if you had a length of four, the token beer and breweries becomes beer, and, and brewe.
| Property | Type | Required? | Description |
|---|---|---|---|
length |
Integer |
Yes |
The maximum character length for an output token. |
Token_maps Object
The token_maps object contains any custom wordlists defined for a Search index:
"token_maps": {
"My_Wordlist": {
"type": "custom",
"tokens": [
"the",
"is",
"and"
]
}
},
| To view the entire JSON payload, click View. |
The token_maps object is a child object of the analysis object.
It contains any number of {wordlist_name} objects:
| Property | Type | Required? | Description |
|---|---|---|---|
{wordlist_name} |
Object |
Yes |
Set the name of this object to the name you want for your custom wordlist. You can reference the For more information about the properties in an |
{Wordlist_name} Object
The {wordlist_name} object defines a custom wordlist for a Search index:
"My_Wordlist": {
"type": "custom",
"tokens": [
"the",
"is",
"and"
]
}
A {wordlist_name} object is a child object of the Token_maps Object.
It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
type |
String |
Yes |
The |
tokens |
Array |
Yes |
An array of strings that contains each word added to the wordlist. |
Date_time_parsers Object
The date_time_parsers object contains any custom date/time parsers defined for a Search index:
"date_time_parsers": {
"My_ISO_Date_Time_Parser": {
"type": "isostyle",
"layouts": [
"yyyy/MM/dd h:mma",
"dd/MM/yyyy HH:mm:ss",
"yyyy-MM-dd'T'HH:mm:ssXX",
"dd MMMM yy ha z",
"yyyy; MMM dd (EEE) hh:mm:ss.SSSSSaa xx"
]
},
"My_Percent_Date_Time_Parser": {
"type": "percentstyle",
"layouts": [
"%Y/%m/%d %l:%M%p",
"%d/%m/%Y %H:%M:%S",
"%Y-%m-%dT%H:%M:%S%z",
"%d %B %y %l%p %Z",
"%Y; %b %d (%a) %I:%M:%S.%N%P %z"
]
}
},
| To view the entire JSON payload, click View. |
The date_time_parsers object is a child object of the analysis object.
It contains any number of {date_time_parser_name} objects:
| Property | Type | Required? | Description |
|---|---|---|---|
{date_time_parser_name} |
Object |
Yes |
Set the name of this object to the name you want for your custom date/time parser. You can reference the For more information about the properties in an |
{date_time_parser_name} Object
The {date_time_parser_name} object defines a custom date/time parser for a Search index:
"My_ISO_Date_Time_Parser": {
"type": "isostyle",
"layouts": [
"yyyy/MM/dd h:mma",
"dd/MM/yyyy HH:mm:ss",
"yyyy-MM-dd'T'HH:mm:ssXX",
"dd MMMM yy ha z",
"yyyy; MMM dd (EEE) hh:mm:ss.SSSSSaa xx"
]
},
"My_Percent_Date_Time_Parser": {
"type": "percentstyle",
"layouts": [
"%Y/%m/%d %l:%M%p",
"%d/%m/%Y %H:%M:%S",
"%Y-%m-%dT%H:%M:%S%z",
"%d %B %y %l%p %Z",
"%Y; %b %d (%a) %I:%M:%S.%N%P %z"
]
}
A {date_time_parser_name} object is a child object of the Date_time_parsers Object.
It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
type |
String |
Yes |
The type of date/time parser you want to create and use in your Search index, based on a specific layout style:
For more information about the available date/time layout styles, see Date/Time Parser Layout Styles. |
layouts |
Array |
Yes |
An array of strings that contains layouts for date and time fields. For more information about how to format a date/time layout for a date/time parser, see Date/Time Parser Layout Styles. |
Synonym_sources Object
Couchbase Server 8.0
The synonym_sources object contains any synonym collections defined for a Search index:
"synonym_sources": {
"synonyms_en": {
"analyzer": "My_Analyzer",
"collection": "synonyms_en"
}
}
| To view the entire JSON payload, click View. |
For more information about synonym searches, see Add Synonyms to a Search Index.
The synonym_sources object is a child object of the analysis object.
It contains any number of {synonym_collection_name} objects:
| Property | Type | Required? | Description |
|---|---|---|---|
{synonym_collection_name} |
Object |
Yes |
Set the name of this object to the name you want to use to identify your synonym collection in your Search index. Reference the For more information about the properties in an |
{synonym_collection_name} Object
Couchbase Server 8.0
The {synonym_collection_name} object defines a synonym collection on a Search index:
"synonyms_en": {
"analyzer": "My_Analyzer",
"collection": "synonyms_en"
}
For more information about synonym searches, see Add Synonyms to a Search Index.
A {synonym_collection_name} object is a child object of the Synonym_sources Object.
It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
analyzer |
String |
Yes |
Enter the name of the analyzer to use for the synonym documents stored in this collection. Set the analyzer for a synonym collection to the same analyzer you set in the Fields Array for a text field. You cannot use synonym searches on a field unless the synonym_source is set and the analyzers match. |
collection |
String |
Yes |
Enter the name of the collection where your synonym documents are stored on your cluster. The synonym collection must be in the same bucket and scope as where you want to define your Search index. Synonym documents must have the proper syntax to be used by the Search Service. For more information, see Create a Synonym Collection and Documents. Do not add your synonym collections as a {scope}.{collection} object in your Search index. |
Default_mapping Object
The default_mapping object contains settings for the default type mapping on the Search index.
The default type mapping is a legacy feature and only included for compatibility.
"default_mapping": {
"dynamic": false,
"enabled": false
},
| To view the entire JSON payload, click View. |
The default_mapping object is a child object of the Mapping Object.
It contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
dynamic |
Boolean |
Yes |
To index all available fields in a document with the default type mapping, set To only index the fields you specify in the type mapping, set |
enabled |
Boolean |
Yes |
To enable the Search Service’s default type mapping, set The default type mapping includes all documents in the bucket in the Search index, even if they do not match another configured type mapping. This can increase index size and indexing time. To disable the default type mapping, set |
Types Object
The types object contains any additional user-defined type mappings for a Search index.
"types": {
"inventory.hotel": {
"dynamic": false,
"enabled": true,
"properties": {
"_$xattrs": {
"dynamic": true,
"enabled": true
},
"reviews": {
"dynamic": false,
"enabled": true,
"properties": {
"content": {
"enabled": true,
"dynamic": false,
"fields": [
{
"docvalues": true,
"include_in_all": true,
"include_term_vectors": true,
"index": true,
"name": "content",
"store": true,
"synonym_source": "synonyms_en",
"type": "text",
"analyzer": "My_Analyzer"
}
]
}
}
},
"city": {
"enabled": true,
"dynamic": false,
"fields": [
{
"docvalues": true,
"include_in_all": true,
"include_term_vectors": true,
"index": true,
"name": "city",
"store": true,
"type": "text"
}
]
}
}
},
"inventory.hotel.free_breakfast_true": {
"dynamic": true,
"enabled": true,
"properties": {
"free_breakfast": {
"dynamic": false,
"enabled": true,
"fields": [
{
"docvalues": true,
"include_in_all": true,
"index": true,
"name": "free_breakfast",
"store": true,
"type": "boolean"
}
]
}
}
}
}
| To view the entire JSON payload, click View. |
The types object is a child object of the Mapping Object.
It contains any number of {scope}.{collection} objects:
| Property | Type | Required? | Description | ||
|---|---|---|---|---|---|
{scope}.{collection} |
Object |
Yes |
The name of the type mapping.
Corresponds to the selected scope and collection where the type mapping applies.
For example, For more information about the properties in an
|
{Scope}.{collection} Objects, JSON Object Field Objects, and XATTRs Objects
The {scope}.{collection} object defines a custom type mapping for a Search index, on a specific scope and collection in the cluster:
"inventory.hotel": {
"dynamic": false,
"enabled": true,
"properties": {
"_$xattrs": {
"dynamic": true,
"enabled": true
},
"reviews": {
"dynamic": false,
"enabled": true,
"properties": {
"content": {
"enabled": true,
"dynamic": false,
"fields": [
{
"docvalues": true,
"include_in_all": true,
"include_term_vectors": true,
"index": true,
"name": "content",
"store": true,
"synonym_source": "synonyms_en",
"type": "text",
"analyzer": "My_Analyzer"
}
]
}
}
},
"city": {
"enabled": true,
"dynamic": false,
"fields": [
{
"docvalues": true,
"include_in_all": true,
"include_term_vectors": true,
"index": true,
"name": "city",
"store": true,
"type": "text"
}
]
}
}
},
"inventory.hotel.free_breakfast_true": {
"dynamic": true,
"enabled": true,
"properties": {
"free_breakfast": {
"dynamic": false,
"enabled": true,
"fields": [
{
"docvalues": true,
"include_in_all": true,
"index": true,
"name": "free_breakfast",
"store": true,
"type": "boolean"
}
]
}
}
}
A {scope}.{collection} object is a child object of the Types Object.
A JSON object field object is a child object of the {scope}.{collection} object.
It defines a mapping for a field that contains a JSON object in your document schema.
It can contain additional mappings as {field_name} Object under its properties object.
A JSON object field object must:
-
Be a child object of a
{scope}.{collection}object. -
Have a name that matches a JSON object child field in your documents.
-
Use the same property structure as a
{scope}.{collection}object.
If your cluster is running Couchbase Server version 7.6.2 and later, and you’re adding Extended Attributes (XATTRs) from your document metadata to your Search index, your XATTRs mapping definition must:
-
Be a child object of a
{scope}.{collection}object. -
Have the name
_$xattrs. -
Use the same property structure as a
{scope}.{collection}object.
For example, the following JSON index definition snippet defines a {scope}.{collection} object for the inventory.hotel scope and collection.
It adds a dynamic mapping for any XATTRs metadata present on documents in the collection.
It adds two nested JSON Object Field objects, reviews and ratings, that contain a single child field object for the Cleanliness field:
{
"inventory.hotel": {
"dynamic": false,
"enabled": true,
"properties": {
"_$xattrs": {
"dynamic": true,
"enabled": true
},
"reviews": {
"dynamic": false,
"enabled": true,
"properties": {
"ratings": {
"dynamic": false,
"enabled": true,
"properties": {
"Cleanliness": {
"enabled": true,
"dynamic": false,
"fields": [
{
"docvalues": true,
"include_in_all": true,
"index": true,
"name": "Cleanliness",
"store": true,
"type": "number"
}
]
}
}
}
}
}
}
}
}
You can view the JSON document schema for this example by looking at any document in the hotel collection from the travel-sample dataset.
For more information, see Manage Documents in the Couchbase Web Console.
{scope}.{collection} objects, JSON Object Field objects, and XATTRs objects can contain the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
dynamic |
Boolean |
Yes |
To index all fields under the specified scope and collection, JSON object, or all fields inside XATTRs, set To only index the fields you specify and enable the |
enabled |
Boolean |
Yes |
To enable the mapping and include any documents that match it in the Search index, set To remove any documents that match this mapping from the Search index, set |
default_analyzer |
String |
No |
The name of the default analyzer to use for any text field defined under this type mapping. If the type mapping is dynamic, this analyzer applies to every text field for documents that match the type mapping. If the type mapping is static, this analyzer only applies to the text fields you add in the The value of For more information about analyzers, see Analyzers. |
default_synonym_source |
String |
No |
Couchbase Server 8.0 The name of the default synonym source to use for any text fields defined under this type mapping. If the type mapping is dynamic, this synonym source applies to every text field for documents that match the type mapping. If the type mapping is static, this synonym source only applies to the text fields you add in the The value of For more information about using synonyms with the Search Service, see Add Synonyms to a Search Index. |
Object |
No |
The Specifies properties for the fields to index in the mapping.
Contains any number of For more information, see {field_name} Object. |
{field_name} Object
The {field_name} object contains properties and an array for a child field in a type mapping.
You can have multiple {field_name} objects in a properties object.
"reviews": {
"dynamic": false,
"enabled": true,
"properties": {
"content": {
"enabled": true,
"dynamic": false,
"fields": [
{
"docvalues": true,
"include_in_all": true,
"include_term_vectors": true,
"index": true,
"name": "content",
"store": true,
"synonym_source": "synonyms_en",
"type": "text",
"analyzer": "My_Analyzer"
}
]
}
}
},
| To view the entire JSON payload, click View. |
The name of the object corresponds to the name of the field you want to include or exclude from your Search index.
A {field_name} object contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
enabled |
Boolean |
Yes |
To add this child field to the Search index, set To remove this child field from the index, set |
dynamic |
Boolean |
No |
This field is included for legacy compatibility only. |
fields |
Array |
Yes |
An array that contains objects with settings for each child field to index in the type mapping. For more information, see Fields Array. |
Fields Array
The fields array contains objects with settings for each child field to index in the type mapping:
"fields": [
{
"docvalues": true,
"include_in_all": true,
"include_term_vectors": true,
"index": true,
"name": "content",
"store": true,
"synonym_source": "synonyms_en",
"type": "text",
"analyzer": "My_Analyzer"
}
]
| To view the entire JSON payload, click View. |
The fields array is located inside a {field_name} object.
It contains the following properties:
| Property | Type | Required? | Description | ||
|---|---|---|---|---|---|
analyzer |
String |
Text Only |
If the child field’s
|
||
Integer |
Vector Only |
For a From Couchbase Server version 7.6.2 and later, Vector Search indexes can support arrays with up to 4096 elements. Arrays can be an array of arrays. For more information about Vector Search indexes, see Vector Search Using Search Vector Indexes or Create a Search Vector Index with the Server Web Console. |
|||
docvalues |
Boolean |
Yes |
To include the value for each instance of the field in the Search index to support facets and sorting search results, set To exclude the values for each instance of this field from the index, set |
||
Boolean |
Yes |
To allow this field to be searched without specifying the specific field’s name in the search, set When enabled, you can search this field through the specified To only search this field by specifying the field name, set |
|||
Boolean |
Yes |
To allow the Search Service to highlight matching search terms in search results for this field, set You must also enable term vectors to use To disable term highlighting and reduce index size, set |
|||
index |
Boolean |
Yes |
To include the child field in the Search index, set To exclude the child field from the index, set |
||
name |
String |
Yes |
The child field’s name. |
||
String |
Vector Only |
For a
For more information about Vector Search indexes, see Vector Search Using Search Vector Indexes or Create a Search Vector Index with the Server Web Console. |
|||
store |
Boolean |
Yes |
To include the content of the child field in the Search index and allow its content to be viewed in search results, set To exclude the content of the child field from the index, set |
||
String |
No |
Couchbase Server 8.0 Enter the name of the {synonym_collection_name} Object you want to use for synonym searches on this field. The Search Service uses any synonym documents stored in this synonym collection for synonym searches on this field. You can only use synonym searches on a field with a The For more information about synonym searches, see Add Synonyms to a Search Index. |
|||
type |
String |
Yes |
The child field’s type. Can be one of:
For more information about the available field data types, see Field Data Types. |
||
vector_index_optimized_for |
String |
Vector Only |
For a
For more information about Vector Search indexes, see Vector Search Using Search Vector Indexes or Create a Search Vector Index with the Server Web Console. |
Store Object
The store object can change settings for merge policy, concurrent persister behavior, and file format version on your Search index.
Depending on your performance needs and specific Search use case, you may want to adjust these values, or leave them as default.
You do not need to provide this object when creating a Search index.
"store": {
"indexType": "scorch",
"scorchPersisterOptions": {
"maxSizeInMemoryMergePerWorker": 20971520,
"numPersisterWorkers": 4
},
"scorchMergePlanOptions":{
"floorSegmentFileSize": 3495253
},
"segmentVersion": 16
}
| To view the entire JSON payload, click View. |
The store object contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
indexType |
String |
No |
The |
scorchPersisterOptions |
Object |
No |
Couchbase Server 8.0 An object that contains settings for in-memory buffer processing in your Search index. For more information, see ScorchPersisterOptions Object. |
scorchMergePlanOptions |
Object |
No |
Couchbase Server 8.0 An object that contains settings for background merging behavior in your Search index. For more information, see ScorchMergePlanOptions Object. |
segmentVersion |
Integer |
No |
The |
ScorchPersisterOptions Object
Couchbase Server 8.0
The scorchPersisterOptions object controls in-memory buffer processing on your Search index.
"scorchPersisterOptions": {
"maxSizeInMemoryMergePerWorker": 20971520,
"numPersisterWorkers": 4
},
| To view the entire JSON payload, click View. |
The scorchPersisterOptions object contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
Integer |
No |
Set a value, in bytes, for how much data from the in-memory buffers each worker should process and flush to disk. A higher value means healthier data flushing from memory to disk, but longer flushing times for each worker, because of the higher data volume. For a Search Vector Index, set For a regular Search index, set You may want to change these recommended values based on your specific use case. |
|
numPersisterWorkers |
Integer |
No |
Set a value for the total number of workers you want to use to process data from in-memory buffers. More workers increases the rate of memory being flushed to disk, but increases the number of files on disk and your disk I/O. For a Search Vector Index, set For a regular Search index, set You may want to change these recommended values based on your specific use case. If you increase your workers, make sure to increase the floorSegmentFileSize, to keep your number of segment files low. |
ScorchMergePlanOptions Object
Couchbase Server 8.0
The scorchMergePlanOptions object controls the background merging behavior for segment files in your Search index.
"scorchMergePlanOptions":{
"floorSegmentFileSize": 3495253
},
| To view the entire JSON payload, click View. |
The scorchMergePlanOptions object contains the following properties:
| Property | Type | Required? | Description |
|---|---|---|---|
Integer |
No |
Set a value, in bytes, for the Search Service’s minimum segment file size. The Search Service merges segments to improve query performance and storage. If a segment is smaller than this minimum file size, the Search Service will merge it during its background merging. A higher value for the minimum segment file size means more aggressive merging behavior and better query performance, at the cost of increased disk I/O and longer merge cycles, with more resource usage. For a Search Vector Index, set \$(\m\a\x\SizeInMem\o\r\yMer\g\ePerW\o\r\ker)/3\$ If you want to improve I/O and indexing performance at the cost of query performance, set \$(\m\a\x\SizeInMem\o\r\yMer\g\ePerW\o\r\ker)/6\$ For a regular Search index, set You may want to change these recommended values based on your specific use case. |