Hyperspace Docs
Hyperspace Homepage
  • Getting started
    • Overview
      • Hyperspace Advantages
      • Hyperspace Search
    • Quick Start
  • flows
    • Setting Up
      • Installing the Hyperspace API Client
      • Connecting to the Hyperspace Server
      • Creating a Database Schema Configuration File
        • Vector Similarity Metrics
        • Index Type Methods
      • Creating a Collection
      • Uploading Data to a Collection
      • Building and Running Queries
        • Building a Lexical Search Query
        • Building a Vector Search Query
        • Building a Hybrid Search Query
      • Retrieving Results
    • Data Collections
      • Uploading Data
      • Accessing Data
      • Supported Data Types
    • Queries
      • DSL Query interface
        • Aggregations
        • Bool Query
        • Candidate Generation and Metadata Filtering
        • Scoring and Ranking
  • Reference
    • Hyperspace Query Flow
    • Features and Benefits
    • Search Processing Unit (SPU)
    • Hyperspace Document Prototype
  • API Documentation
    • Hyperspace Client
      • add_batch
      • add_document
      • async_req
      • clear_collection
      • collections_info
      • commit
      • create_collection
      • delete_collection
      • delete_by_query
      • dsl_search
      • get_schema
      • get_document
      • reset_password
      • search
      • update_by_query
      • update_document
    • DSL Query Framework
      • Aggregations
        • Cardinality Aggregation
        • Date Histogram
        • Metric Aggregations
        • Terms Aggregation
      • Bool Queries
        • Free Text Search
        • 'match' Clause
        • 'filter' Clause
        • 'must' Clause
        • 'must_not' Clause
        • 'should' Clause
        • 'should_not' Clause
      • Candidate Generation and Metadata Filtering
        • Geo Coordinates Match
        • Range Match
        • Term Match
      • Scoring and Ranking
        • Boost
        • 'dis_max'
        • Function Score
        • Rarity Score (TF-IDF)
  • Releases
    • 2024 Releases
Powered by GitBook
On this page
  1. API Documentation
  2. Hyperspace Client

create_collection

PreviouscommitNextdelete_collection

Last updated 10 months ago

The function create_collection(schema, collection_name) creates a new collection, according to the provided schema configuration.

Input

  • schema – Specifies the path to the configuration file (for example, \schema.json) that you created locally on your machine, as described in

  • collection_name – Specifies the name of the collection to be created in the Hyperspace database. You can specify any name as long as it is unique to your Hyperspace Collection.

Example

collection_name = 'new_collection'
hyperspace_client.create_collection('schema.json', collection_name)
Object collection_name = 'new_collection';
hyperspaceClient.createCollection('schema.json', collection_name);
const collection_name = 'new_collection';

await hyperspaceClient.indices.create({
    index: collectionName,
    body: 'schema.json'
})

Where -

  • 'schema.json' - can be any of the following:

    • The score function (python only)

    • The score function as string

    • The name of the file that includes the score function

Response

The following response should be received –

{'status': 'OK', 'code': 200, 'message': 'Collection was successfully created'}

Collections are a fundamental concept in databases that may organize data as Collections of documents. Collections don't enforce a fixed schema or predefined structure, allowing each document within a Collection to have its own unique set of fields and data. Serving as containers for related documents and records, Collections facilitate logical grouping, making it simpler to organize, manage, and efficiently query, index, and retrieve related data.

Creating a Database Schema Configuration File.