Skip to main content

Create Index

Creates an Index.

Indexes are created with unique IDs like idx_rHlXLhCTma74w1E_xbRXl. These IDs are unique and cannot be changed. In a future release we will be adding the ability to alias Indexes, supporting names.

This is an asynchronous operation.

Index configuration

Index types

Indexes have and index type that determines how the data inserted is processesed.

We currently support 2 Index types:

  • text - semantically search text content using state of the art text embeddings for search
  • image - semantically search images with text using image embeddings for search

Object fields

Indexes support configuring how fields in Objects that are indexed are processed. The following configurations are supported at a field level:

  1. Crawlable - fields which will be crawled and made available for search. Read more about crawling.
  2. Searchable - fields which will contribute to search relevance.
  3. Filterable - fields which may be filtered upon. Read more about filtering.
  4. Types - A mapping of fields to data types for filterable fields. By default all filterable fields are considered strings, unless specified here. For more info on supported types see field types.

API Spec

POST /indexes

Path parameters

None

Query parameters

None

Request body

{
"properties": {
"configuration": {
"type": "object",
"properties": {
"index_type": {
"type": "object",
"properties": {
"name": {
"type": "string",
"enum": ["text", "image"]
},
},
"required": ["name"]
},
"fields": {
"type": "object",
"properties": {
"crawlable": {
"type": "object",
"properties": {
"allow": {
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"filterable": {
"type": "object",
"properties": {
"allow": {
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"searchable": {
"type": "object",
"properties": {
"allow": {
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"types": {
"type": "object",
}
}
},
}
},
}
}
}

Response

Status codes

  • 202 Successful response
  • 404 Invalid index type, credentials, etc
  • 422 Validation error

Examples

Example: Create an Index
curl -X 'POST' https://api.objective.inc/v1/indexes \
-H 'Authorization: Bearer $APIKEY' \
-d {
"configuration": {
"index_type": {
"name": "image"
},
"fields": {
"searchable": {
"allow": ["title", "description"],
"deny": ["image_url"]
},
"crawlable": {
"allow": ["image_url"]
},
"filterable": {
"allow": ["price"]
},
"types": {
"price": "float"
}
}
}
}

# Response
{
"id": "idx_rHlXLhCTma74w1E_xbRXl",
}