---
description: "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."
---

import DocCard from '@theme/DocCard';
import Icons from '@theme/Icon';

# Search Service

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

## Overview

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 endpoints, 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](../fundamentals/dependency-injection.md), the Medusa backend will then use and resolve the search service within the backend’s search operations, such as when the [Search Products](https://docs.medusajs.com/api/store#products_postproductssearch) endpoint is used. You can also [resolve the service](../services/create-service.mdx#use-a-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](../../plugins/search/index.mdx).

### 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.

<DocCard item={{
  type: 'link',
  href: '/development/search/create',
  label: 'Create a Search service',
  customProps: {
    icon: Icons['academic-cap-solid'],
    description: 'Learn how to create a search service.'
  }
}} />