Skip to main content
Elixir SDK / Types Reference for the structs passed to and returned from Moss.Client and Moss.Session. Each is a plain Elixir struct.

DocumentInfo

A document stored in or returned from an index.
%Moss.DocumentInfo{
  id: String.t(),
  text: String.t(),
  metadata: map() | nil,
  embedding: [float()] | nil
}
FieldTypeDescription
idString.t()Unique document ID.
textString.t()Document text.
metadatamap() | nilOptional string key/value metadata, usable in filters. Defaults to nil.
embedding[float()] | nilOptional pre-computed embedding. Required when the index or session uses the "custom" model. Defaults to nil.

SearchResult

Returned by query/4 and query/3.
%Moss.SearchResult{
  docs: [Moss.QueryResultDoc.t()],
  query: String.t(),
  index_name: String.t(),
  time_taken_ms: number()
}
FieldTypeDescription
docs[Moss.QueryResultDoc.t()]Matching documents, ordered by relevance.
queryString.t()The query text that was run.
index_nameString.t()The index that was searched.
time_taken_msnumber()Time the query took, in milliseconds.

QueryResultDoc

A single match within a SearchResult.
%Moss.QueryResultDoc{
  id: String.t(),
  text: String.t(),
  score: float(),
  metadata: map() | nil
}
FieldTypeDescription
idString.t()Document ID.
textString.t()Document text.
scorefloat()Relevance score for this match.
metadatamap() | nilDocument metadata, if any.

IndexInfo

Metadata about a cloud or local index, returned by get_index/2, list_indexes/1, load_index/3, and get_index_info/2.
%Moss.IndexInfo{
  id: String.t(),
  name: String.t(),
  version: String.t(),
  status: String.t(),
  doc_count: non_neg_integer(),
  created_at: String.t(),
  updated_at: String.t(),
  model: Moss.ModelRef.t()
}
FieldTypeDescription
idString.t()Index identifier.
nameString.t()Index name.
versionString.t()Index version.
statusString.t()Current index status.
doc_countnon_neg_integer()Number of documents in the index.
created_atString.t()Creation timestamp.
updated_atString.t()Last-updated timestamp.
modelMoss.ModelRef.t()The embedding model the index uses.

ModelRef

A reference to an embedding model.
%Moss.ModelRef{
  id: String.t(),
  version: String.t()
}
FieldTypeDescription
idString.t()Model ID, for example "moss-minilm", "moss-mediumlm", or "custom".
versionString.t()Model version.

MutationResult

Returned by cloud mutations: create_index/4, add_docs/4, and delete_docs/3.
%Moss.MutationResult{
  job_id: String.t(),
  index_name: String.t(),
  doc_count: non_neg_integer()
}
FieldTypeDescription
job_idString.t()ID of the async job; poll with get_job_status/2.
index_nameString.t()The affected index.
doc_countnon_neg_integer()Document count after the mutation.

PushIndexResult

Returned by Moss.Session.push_index/1. Poll job_id with get_job_status/2 until status is "ready".
%Moss.PushIndexResult{
  job_id: String.t(),
  index_name: String.t(),
  doc_count: non_neg_integer(),
  status: String.t()
}
FieldTypeDescription
job_idString.t()ID of the push job.
index_nameString.t()The cloud index that was created or replaced.
doc_countnon_neg_integer()Number of documents pushed.
statusString.t()Current job status.

RefreshResult

Returned by refresh_index/2.
%Moss.RefreshResult{
  index_name: String.t(),
  previous_updated_at: String.t(),
  new_updated_at: String.t(),
  was_updated: boolean()
}
FieldTypeDescription
index_nameString.t()The refreshed index.
previous_updated_atString.t()The index timestamp before the refresh.
new_updated_atString.t()The index timestamp after the refresh.
was_updatedboolean()Whether the refresh pulled new data.

JobStatusResponse

Returned by get_job_status/2.
%Moss.JobStatusResponse{
  job_id: String.t(),
  status: String.t(),
  progress: number(),
  current_phase: String.t() | nil,
  error: String.t() | nil,
  created_at: String.t(),
  updated_at: String.t(),
  completed_at: String.t() | nil
}
FieldTypeDescription
job_idString.t()The job being polled.
statusString.t()Job status, for example "ready".
progressnumber()Progress fraction.
current_phaseString.t() | nilCurrent processing phase, if any.
errorString.t() | nilError message if the job failed.
created_atString.t()When the job was created.
updated_atString.t()When the job was last updated.
completed_atString.t() | nilWhen the job completed, if finished.