Skip to main content

How to setup collections in Pharia Search

Introduction

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

Prerequisites

Before starting, ensure you have:

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

Get your authorization token

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

  1. Go to the Pharia Studio 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 Pharia Search 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.

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 - PhariaAI

You can configure this index in the Pharia Assistant API via an environment variable. For example:

# values.yml
pharia-assistant-api:
env:
RETRIEVER_QA_INDEX_NAME: {index}

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: