Whatever message this page gives is out now! Go check it out!

VectorStore

Last update:
May 18, 2026

Description

Initializes a new Vector Store Client instance. This function acts as the factory for connecting to various vector store providers (such as InMemory, Milvus, Pinecone, Chroma, and Qdrant). It handles connection configuration, authentication, and default collection settings.

Syntax

VectorStore(struct configuration)

History

New in ColdFusion 2025.0.08

Parameters

NameTypeRequiredDescription
configurationStructYesA structure containing connection and collection configuration details.
Configuration struct details
The configuration structure supports the following keys. Applicability may vary by provider (Milvus, Pinecone, Qdrant, Chroma).
Milvus
Key
Type
Default
Description
Required
url
string
Milvus service endpoint
Yes
dimension
number
Vector dimension
Yes
collectionName
string
default
Name of the collection
No
databaseName
string
default
Database name
No
metricType
string
COSINE
Similarity metric
No
indexType
string
HNSW
Index type used for vector search
No
apiKey
string
API key for authentication
No
username
string
Username for authentication
No
password
string
Password for authentication
No
connectionSettings
Struct
No
The keys are specified below:
callTimeout
duration
60s
RPC call timeout
No
connectionTimeout
duration
20s
Connection timeout
No
keepAlive
boolean
true
Enable keep-alive
No
keepAliveTime
duration
30s
Keep-alive interval
No
keepAliveTimeout
duration
5s
Keep-alive timeout
No
idleTimeout
duration
600s
Idle timeout
No
deadline
duration
180s
Overall deadline
No
retrySettings
Struct
No
The keys are specified below:
maxRetries
number
10
Maximum retries
No
retryOnRateLimit
boolean
true
Retry on rate limit
No
initialBackoff
duration
500ms
Initial backoff
No
maxBackoff
duration
3s
Maximum backoff
No
backoffMultiplier
number
3
Backoff multiplier
No
Pinecone
Key
Type
Default
Description
Required
apiKey
string
API key
Yes
indexName
string
Index name
Yes
namespace
string
default
Namespace
No
podConfig
Struct
The keys are specified below:
dimension
number
Vector dimension
Conditional
environment
string
Deployment environment
Conditional
podType
string
Pod type
Conditional
serverlessConfig
Struct
The keys are specified below:
dimension
number
Vector dimension
Yes
cloud
string
Cloud provider
Conditional
region
string
Cloud region
Conditional
deletionProtection
boolean
Deletion protection
No
IMPORTANT: Either podConfig or serverlessConfig is required, and all fields in their respective sections are required.
Qdrant
Key
Type
Default
Description
Required
url
string
Service endpoint
Yes
dimension
number
Vector dimension
Yes
collectionName
string
default
Collection name
No
apiKey
string
API key
No
metricType
string
COSINE
Similarity metric
No
connectionSettings
Struct
No
The keys are specified below:
callTimeout
duration
60s
RPC call timeout
No
connectionTimeout
duration
20s
Connection timeout
No
keepAlive
boolean
true
Enable keep-alive
No
keepAliveTime
duration
30s
Keep-alive interval
No
keepAliveTimeout
duration
5s
Keep-alive timeout
No
idleTimeout
duration
600s
Idle timeout
No
retrySettings
Struct
No
The keys are specified below:
maxRetries
number
10
Maximum retries
No
initialBackoff
duration
500ms
Initial backoff
No
maxBackoff
duration
3000ms
Maximum backoff
No
backoffMultiplier
number
3
Backoff multiplier
No
Chroma
Key
Type
Default
Description
Required
url
string
Service endpoint
Yes
collectionName
string
default
Collection name
No
databaseName
string
default
Database name
No
tenantName
string
default
Tenant name
No
callTimeout
duration
60s
Request timeout
No

Returns

A VectorStoreClient object used to perform data and collection operations.

Usage

Use this function to establish the connection before performing any CRUD or search operations. If an embeddingModel is provided in the configuration, the client will automatically handle text-to-vector conversion.

Example

<cfscript>
    try {
        vectorstoreclient = vectorStore({
            "provider": "milvus",
            "url": "http://your-milvus-host:19530",
            "databaseName": "default",
            "collectionName": "cf_docs",
            "dimension": 768,
            "metricType": "COSINE",
            "indexType": "HNSW",
            "apiKey": "",
            "embeddingModel": {
                "provider": "ollama",
                "modelName": "nomic-embed-text:latest",
                "baseUrl": "http://localhost:11434",
                "dimension": 768
            }
        });

        writeDump(vectorstoreclient.add({
            "text": "ColdFusion is a rapid application development platform.",
            "metadata": { "product": "coldfusion", "year": 2025 }
        }));

        writeDump(vectorstoreclient.search({
            "text": "rapid application development",
            "minScore": 0.25,
            "topK": 5,
            "filter": { "year": 2025 }
        }));
    } 
    catch (any e) {
        writeDump(e);
    }
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page