vector-index
on the testing bucket.
We are defining an index on the testing
bucket’s _default
scope on the _default
collection with the vector field set to embedding
with 1536 dimensions and the text field set to text
.
We are also indexing and storing all the fields under metadata
in the document as a dynamic mapping to account for varying document structures. The similarity metric is set to dot_product
.
index.json
fields
parameter in the filter during searches.
These fields are returned as part of the metadata
object. You can fetch any field that is stored in the index.
The textKey
of the document is returned as part of the document’s pageContent
.
If you do not specify any fields to be fetched, all the fields stored in the index are returned.
If you want to fetch one of the fields in the metadata, you need to specify it using .
For example, to fetch the source
field in the metadata, you need to use metadata.source
.
metadata
object.
The results will be based on the combination of the results from both vector search and the searches supported by full text search service.
The scores of each of the component searches are added up to get the total score of the result.
To perform hybrid searches, there is an optional key, searchOptions
in fields
parameter that can be passed to all the similarity searches.searchOptions
can be found here.
date
between 2010 & 2020, rating
between 1 & 5 and author
set to either John Doe or Jane Doe.
We will also declare few sample queries.
metadata
object.
metadata.date
.
metadata.rating
.
searchOptions
Key of filter
parameter.
Please refer to the documentation for more details on the available query methods and their syntax.
CouchbaseVectorStore
object.
metadata
field in the document not being indexed and/or stored by the Couchbase Search index. In order to index the metadata
field in the document, you need to add it to the index as a child mapping.
If you select to map all the fields in the mapping, you will be able to search by all metadata fields. Alternatively, to optimize the index, you can select the specific fields inside metadata
object to be indexed.
You can refer to the docs to learn more about indexing child mappings.
To create Child Mappings, you can refer to the following docs -