Typesense (typesense v0.2.0)
A lightweight Typesense client for Elixir.
Installation
If available in Hex, the package can be installed
by adding typesense to your list of dependencies in mix.exs:
def deps do
[
{:typesense, "~> 0.2.0"}
]
endConfiguration
# config/config.exs
config :typesense,
api_url: "https://search.example.com",
api_key: "secret"Usage
To create a Typesense Collection:
schema = %{
name: "companies",
fields: [
%{name: "company_name", type: "string"},
%{name: "num_employees", type: "int32"},
%{name: "country", type: "string", facet: true},
],
default_sorting_field: "num_employees"
}
Typesense.Collections.create(schema)To index a Typesense Document:
document = %{
id: "124",
company_name: "Stark Industries",
num_employees: 5215,
country: "USA"
}
Typesense.Documents.create(collection, document)
Link to this section Summary
Link to this section Types
Link to this type
option()
Specs
option() ::
{:method, Tesla.Env.method()}
| {:url, Tesla.Env.url()}
| {:query, Tesla.Env.query()}
| {:headers, Tesla.Env.headers()}
| {:body, Tesla.Env.body()}
| {:opts, Tesla.Env.opts()}
Link to this section Functions
Link to this function
health()
Returns Typesense instance health status.