Skip to main content
Skip to main content

Search Service

In this document, you’ll learn what a search service is and how it’s used in Medusa.


A search service is used to manage search indices of searchable items, such as products, and providing results for search operations. Although the Medusa core provides basic search functionalities through its API Routes, a search service allows you to integrate third-party services for an optimized search experience and rich search functionalities.

A search service is a service class that is defined in a TypeScript or JavaScript file, which is created in the src/services directory of your Medusa backend codebase or plugin. The class must extend the AbstractSearchService class imported from the @medusajs/utils package.

Using the dependency container and injection, the Medusa backend will then use and resolve the search service within the backend’s search operations, such as when the Search Products API Route is used. You can also resolve the service within your resources to trigger the search where necessary.

Medusa provides official plugins that you can install and use in your Medusa backend. Check out available search plugins here.

Hierarchy of Search Services

Medusa provides a default search service that doesn’t actually perform any indexing or searching, but acts like a placeholder search service. Only one search service is registered in the dependency container under the searchService name.

If you install a search plugin, the search service within it will be registered in the dependency container and used throughout the Medusa backend.

If you create your own search service in the Medusa backend codebase, it will be registered in the dependency container and used throughout the Medusa backend.

Custom Development

Developers can create a custom search service with the desired functionality or third-party integration either directly within the Medusa Core, in a plugin, or in a module.

Was this section helpful?