Typesensory.Api.Collections (Typesensory v0.1.0)
API calls for all endpoints tagged Collections
.
Link to this section Summary
Functions
Create a new collection When a collection is created, we give it a name and describe the fields that will be indexed from the documents added to the collection.
Delete an alias
Delete a collection Permanently drops a collection. This action cannot be undone. For large collections, this might have an impact on read latencies.
Retrieve an alias Find out which collection an alias points to by fetching it
List all aliases List all aliases and the corresponding collections that they map to.
Retrieve a single collection Retrieve the details of a collection, given its name.
List all collections Returns a summary of all your collections. The collections are returned sorted by creation date, with the most recent collections appearing first.
Update a collection Update a collection's schema to modify the fields and their types.
Create or update a collection alias Create or update a collection alias. An alias is a virtual collection name that points to a real collection. If you're familiar with symbolic links on Linux, it's very similar to that. Aliases are useful when you want to reindex your data in the background on a new collection and switch your application to it without any changes to your code.
Link to this section Functions
create_collection(connection, collection_schema, opts \\ [])
@spec create_collection( Tesla.Env.client(), Typesensory.Model.CollectionSchema.t(), keyword() ) :: {:ok, Typesensory.Model.CollectionResponse.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Create a new collection When a collection is created, we give it a name and describe the fields that will be indexed from the documents added to the collection.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_schema
(CollectionSchema): The collection object to be createdopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.CollectionResponse.t}
on success{:error, Tesla.Env.t}
on failure
delete_alias(connection, alias_name, opts \\ [])
@spec delete_alias(Tesla.Env.client(), String.t(), keyword()) :: {:ok, Typesensory.Model.CollectionAlias.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Delete an alias
parameters
Parameters
connection
(Typesensory.Connection): Connection to serveralias_name
(String.t): The name of the alias to deleteopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.CollectionAlias.t}
on success{:error, Tesla.Env.t}
on failure
delete_collection(connection, collection_name, opts \\ [])
@spec delete_collection(Tesla.Env.client(), String.t(), keyword()) :: {:ok, Typesensory.Model.CollectionResponse.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Delete a collection Permanently drops a collection. This action cannot be undone. For large collections, this might have an impact on read latencies.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to deleteopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.CollectionResponse.t}
on success{:error, Tesla.Env.t}
on failure
get_alias(connection, alias_name, opts \\ [])
@spec get_alias(Tesla.Env.client(), String.t(), keyword()) :: {:ok, Typesensory.Model.CollectionAlias.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Retrieve an alias Find out which collection an alias points to by fetching it
parameters
Parameters
connection
(Typesensory.Connection): Connection to serveralias_name
(String.t): The name of the alias to retrieveopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.CollectionAlias.t}
on success{:error, Tesla.Env.t}
on failure
get_aliases(connection, opts \\ [])
@spec get_aliases( Tesla.Env.client(), keyword() ) :: {:ok, Typesensory.Model.CollectionAliasesResponse.t()} | {:error, Tesla.Env.t()}
List all aliases List all aliases and the corresponding collections that they map to.
parameters
Parameters
connection
(Typesensory.Connection): Connection to serveropts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.CollectionAliasesResponse.t}
on success{:error, Tesla.Env.t}
on failure
get_collection(connection, collection_name, opts \\ [])
@spec get_collection(Tesla.Env.client(), String.t(), keyword()) :: {:ok, Typesensory.Model.CollectionResponse.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Retrieve a single collection Retrieve the details of a collection, given its name.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to retrieveopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.CollectionResponse.t}
on success{:error, Tesla.Env.t}
on failure
get_collections(connection, opts \\ [])
@spec get_collections( Tesla.Env.client(), keyword() ) :: {:ok, [Typesensory.Model.CollectionResponse.t()]} | {:error, Tesla.Env.t()}
List all collections Returns a summary of all your collections. The collections are returned sorted by creation date, with the most recent collections appearing first.
parameters
Parameters
connection
(Typesensory.Connection): Connection to serveropts
(keyword): Optional parameters
returns
Returns
{:ok, [%CollectionResponse{}, ...]}
on success{:error, Tesla.Env.t}
on failure
update_collection(connection, collection_name, collection_update_schema, opts \\ [])
@spec update_collection( Tesla.Env.client(), String.t(), Typesensory.Model.CollectionUpdateSchema.t(), keyword() ) :: {:ok, Typesensory.Model.ApiResponse.t()} | {:ok, Typesensory.Model.CollectionUpdateSchema.t()} | {:error, Tesla.Env.t()}
Update a collection Update a collection's schema to modify the fields and their types.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to updatecollection_update_schema
(CollectionUpdateSchema): The document object with fields to be updatedopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.CollectionUpdateSchema.t}
on success{:error, Tesla.Env.t}
on failure
upsert_alias(connection, alias_name, opts \\ [])
@spec upsert_alias(Tesla.Env.client(), String.t(), keyword()) :: {:ok, Typesensory.Model.CollectionAlias.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Create or update a collection alias Create or update a collection alias. An alias is a virtual collection name that points to a real collection. If you're familiar with symbolic links on Linux, it's very similar to that. Aliases are useful when you want to reindex your data in the background on a new collection and switch your application to it without any changes to your code.
parameters
Parameters
connection
(Typesensory.Connection): Connection to serveralias_name
(String.t): The name of the alias to create/updateopts
(keyword): Optional parameters:body
(CollectionAliasSchema): Collection alias to be created/updated
returns
Returns
{:ok, Typesensory.Model.CollectionAlias.t}
on success{:error, Tesla.Env.t}
on failure