Serverless Search
Serverless Search is enabled using the @search
directive on a database model or field.
The @search
directive will automatically index the data inside the Grafbase Database for the selected model (or field), and generate Serverless Search query.
Models can be indexed by using @search
when declaring the database @model
:
type Order @model @search {
customer: Email!
total: Int! @default(value: 0)
shipped: Boolean @default(value: false)
}
The createdAt
and updatedAt
fields will be indexed too.
Models can be indexed by using @search
when declaring each of your database fields:
type Order @model {
customer: Email! @search
total: Int! @default(value: 0) @search
shipped: Boolean @default(value: false)
notes: String @search
}
Fields using the type URL
, PhoneNumber
, String
, Int
, Float
, Date
, DateTime
, Timestamp
, Boolean
, IPAddress
, and enumerations will be indexable.
- Only data created after
@search
is added will be indexed. - It's not currently possible to use the
last
argument when paginating.