Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 92 additions & 2 deletions modules/search/examples/simple-search-index-payload.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,78 @@
"doc_config": {
"docid_prefix_delim": "",
"docid_regexp": "",
"mode": "scope.collection.type_field",
"type_field": "type"
"mode": "scope.collection.custom",
"type_field": "type",
// tag::doc_filter[]
"doc_filter": {
// tag::boolean_filter[]
"free_breakfast_true": {
"bool": true,
"field": "free_breakfast",
"order": 1
},
// end::boolean_filter[]
// tag::date_range_filter[]
"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"
},
// end::date_range_filter[]
// tag::numeric_range_filter[]
"cleanliness_range": {
"min": 3,
"max": 5,
"inclusive_min": true,
"inclusive_max": true,
"field": "reviews.ratings.Cleanliness",
"order": 3
},
// end::numeric_range_filter[]
// tag::conjunct_filter[]
"free_parking_AND_vacancy": {
"conjuncts": [
{
"bool": true,
"field": "vacancy"
},
{
"bool": true,
"field": "free_parking"
}
],
"order": 4
},
// end::conjunct_filter[]
// tag::disjunct_filter[]
"location_OR_service": {
"disjuncts": [
{
"min": 5,
"field": "reviews.ratings.Service"
},
{
"min": 5,
"field": "reviews.ratings.Location"
}
],
"order": 6
},
// end::disjunct_filter[]
// tag::term_filter[]
"name_hotel": {
"term": "Hotel",
"order": 5,
"field": "name"
}
// end::term_filter[]

}
// end::doc_filter[]
},
// end::doc_config[]
// tag::mapping[]
Expand Down Expand Up @@ -178,6 +248,26 @@
"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"
}
]
}
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions modules/search/pages/create-type-mapping.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ To add an entire collection as a new type mapping:
. xref:type-mapping-options.adoc#collection[Configure your type mapping options].
. Click btn:[Add To Index].

[#filter-mapping]
==== Add a Document Filter to a Collection Type Mapping

You can add a xref:customize-index.adoc#type-identifiers[document filter] to any collection type mapping on your Search index.
A document filter adds or removes documents from a collection type mapping in your Search index.

To add a document filter to a mapping, see xref:set-type-identifier.adoc[].

[#xattrs]
=== Add an XATTRs Mapping

Expand Down
11 changes: 9 additions & 2 deletions modules/search/pages/customize-index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,27 @@ In Advanced Mode, you can also choose and configure an additional document filte
* *JSON Type Field*: Selects only documents that contain a specific field with a specified string value.
* *Doc ID up to Separator*: Selects only documents with an ID or key up to a specific substring.
* *Doc ID with Regex*: Selects only documents with an ID or key that matches a regular expression.
* [.status]#Couchbase Server 8.0# *Custom*: As of Couchbase Server version 8.0, custom document filters select only documents that match a custom filter, based on the values of specific fields.

For more information about how to configure a document filter, see xref:set-type-identifier.adoc[].
Document filters add a more granular filter to the documents in a collection <<type-mappings,type mapping>>.
If a collection mapping has a document filter, only documents that pass the filter can be included in the Search index under that collection.

For more information about how to create a document filter, see xref:set-type-identifier.adoc[].

[#type-mappings]
== Type Mappings and Mappings

Use a type mapping to include or exclude specific documents in a collection from an index.

Type mappings can also set a field's data type and other settings.
Type mappings can also set a document field's data type and other settings.

Type mappings start at the collection level.
Create additional mappings for document fields or JSON objects under a collection's type mapping to restrict the documents added to your index.
This can improve Search index performance over indexing entire collections.

For a type mapping defined on a scope and collection, you can create an additional <<type-identifiers,document filter>> to restrict the documents added under that type mapping.
Only documents from your specified scope and collection that also pass the document filter can be included in your Search index, and potentially returned in search results.

If your operational cluster is running Couchbase Server version 7.6.2 and later, you can also choose to include document metadata inside your Search index by creating an XATTRs mapping.
For more information about how to configure settings for the different types of mappings and type mappings, see xref:type-mapping-options.adoc[].

Expand Down
Loading