Dowser.Opensearch.MappingError exception (Dowser.Opensearch v0.1.0)

View Source

The mapping a document had to be cast against could not be fetched.

Casting is what turns a date field into a DateTime, a date_range into a Date.Range, and back. Without the mapping, Dowser.Opensearch.Codec has nothing to dispatch on and every value passes through as the raw JSON term — so the type a caller gets back would depend on whether a _mapping request happened to succeed. That request is an OpenSearch call like any other, most likely to fail exactly when the cluster is overloaded, which is when code is least able to cope with a %{"gte" => ..., "lte" => ...} where it expects a Date.Range.

So a failed fetch raises this by default, and the request fails with it rather than quietly returning uncast values. :index is the index whose mapping was wanted and :reason what the fetch returned.

See Dowser.Opensearch.Codec's :mapping_failure option for the other policies (:warn, :ignore), and Dowser.Opensearch.MappingCacher for mappings that are never fetched and so can never fail.

Summary

Types

t()

@type t() :: %Dowser.Opensearch.MappingError{
  __exception__: true,
  index: term(),
  reason: term()
}