Skip to main content

How to setup collections in PhariaSearch

Introduction

This guide explains how to set up the foundational components needed for document collections in PhariaSearch. You'll learn how to create namespaces, collections, and configure indexes.

Prerequisites

Before starting, ensure you have:

  • PhariaSearch (Document Index) deployed - https://document-index.{ingressDomain}
  • Access to PhariaStudio - https://pharia-studio.{ingressDomain}
  • Basic familiarity with REST APIs

Get your authorization token

To use the API, you need access to the PhariaStudio token. Follow these steps to retrieve it:

  1. Go to the PhariaStudio page and log in if necessary.
  2. In the upper-right corner, click on your profile.
  3. In the popup, click on Copy Bearer Token.

copy-bearer-token

Setting up your environment

The PhariaSearch API provides an interface for creating and managing document collections. Access the API documentation at https://document-index.{ingressDomain}/openapi.yaml.

Step 1: Create a namespace

A namespace is like a project space that helps organize your collections:

curl -X PUT \
'https://document-index.{ingressDomain}/namespaces/{namespace}' \
-H 'Authorization: Bearer {your-token}'

Step 2: Create a collection

Collections store your documents within a namespace:

curl -X PUT \
'https://document-index.{ingressDomain}/collections/{namespace}/{collection}' \
-H 'Authorization: Bearer {your-token}'

Step 3: Configure an index

Indexes determine how your documents are processed and searched:

curl -X PUT \
'https://document-index.{ingressDomain}/indexes/{namespace}/{index}' \
-H 'Authorization: Bearer {your-token}' \
-H 'Content-Type: application/json' \
-d '{
"chunk_size": 384,
"chunk_overlap": 0,
"embedding_type": "asymmetric"
}'

For hybrid search capabilities, include "hybrid_index": "bm25" in the configuration.

For more guidance on selecting the optimal index settings for your use case, see recommended index configuration.

Step 4: Assign index to collection

Connect your index configuration to your collection:

curl -X PUT \
'https://document-index.{ingressDomain}/collections/{namespace}/{collection}/indexes/{index}' \
-H 'Authorization: Bearer {your-token}'

Validation

Verify your setup using:

curl -X GET \
'https://document-index.{ingressDomain}/namespaces/{namespace}/collections' \
-H 'Authorization: Bearer {your-token}'

Extra Configuration - PhariaAssistant

For setting up collections for PhariaAssistant Chat, follow the guide in Configuring which collections are visible to PhariaAssistant.

Troubleshooting

Common setup issues:

Authorization Errors

  • Error: 401 Unauthorized
    • Solution: Verify token is current and properly formatted

Next Steps

Now that your collection is set up, learn how to: