Skip to content

Performing search across multiple indexes on Orama Cloud

After deploying your index, Orama will distribute it to over 300 global points of presence across more than 100 countries worldwide. This will guarantee the lowest possible latency for any search query, at any scale.

At the time of this writing, you can execute search queries using our official JavaScript SDK.

This SDK manages connection, cache, telemetry, and type safety for all your search operations. It is the official method for communicating with Orama Cloud.

Make sure you have the Orama SDK installed to start performing full-text, vector, and hybrid search at a massive scale!

Seach across multiple indexes deployed on Orama Cloud

Once you have your SDK for your preferred language installed, you can start performing search across multiple indexes deployed on Orama Cloud.

The client exposes a simple search method that can be used to query the index. Read the full documentation here

Search across multiple indexes

import { OramaClient } from "@oramacloud/client";
const client = new OramaClient({
mergeResults: false
indexes:[
{api_key: "<Your Orama Cloud API Key index 1>", endpoint:"<Your Orama Cloud Endpoint index 1>"},
{api_key: "<Your Orama Cloud API Key index 2>", endpoint:"<Your Orama Cloud Endpoint index 2>"},
]
});
const results = await client.search({
term: "red shoes",
mode: "fulltext", // optional, default is "fulltext" but can also be "vector" or "hybrid"
});

Result

This will return an array of search results from both indexes.

[
{
"elapsed": ...,
"count": ...,
"hits": { ... },
},
{
"elapsed": ...,
"count": ...,
"hits": { ... },
}
]

If mergeResults is set to true, the results will be merged into a single results.

{
"elapsed": ...,
"count": ...,
"hits": { ... },
}