const searchResults = await index.search({
  query: "space opera",
  limit: 2,
});
console.log(searchResults);

The search method is designed to retrieve the most relevant documents from the database, using AI-powered search capabilities. This method supports a variety of options to configure the query to your needs.

The score returned from search requests is a normalized value between 0 and 1, where 1 indicates the highest relevance and 0 the lowest.

Arguments

Payload
SearchCommandPayload
required

Response

Response
SearchResult
required
const searchResults = await index.search({
  query: "space opera",
  limit: 2,
});
console.log(searchResults);