# OpenSearchDocumentStore

The core document store of <ProductName />.

***

## Basic Information

- Used with the following retrievers:
  - `OpenSearchBM25Retriever`
  - `OpenSearchEmbeddingRetriever`
- Type: `haystack_integrations.document_stores.opensearch.document_store.OpenSearchDocumentStore`

## Overview

For details on how this document store works, see [OpenSearchDocumentStore ](https://docs.haystack.deepset.ai/docs/opensearch-document-store)in the Haystack documentation.

## Authorization

This is the core document store of <ProductName /> and as such, we handle the authorization.

## Example Configuration

### In an Index

To write the preprocesses files into the document store:

1. Add `DocumentWriter` to your pipeline.
2. Add `OpenSearchDocumentStore` and configure it on the component card. 
3. Connect `OpenSearchDocumentStore` to `DocumentWriter`.

### In a Query Pipeline

To retrieve files from the document store:

1. Add an OpenSearch retriever to your pipeline.
2. Add `OpenSearchDocumentStore` and configure it on the component card.
3. Connect `OpenSearchDocumentStore` to the retriever. 

### Example

This is an example of the document store connected to a keyword and a vector retriever:

<ClickableImage
  src="/img/concepts/opensearchdocumentstore.png"
  alt="The document store connected to a retriever"
  size="standard"
/>

When you switch to YAML, you'll see that the document store is an argument of each retriever:

```yaml
components:
  query_expander:
    type: haystack.components.query.query_expander.QueryExpander
    init_parameters:
      n_expansions: 3
      include_original_query: true

      chat_generator:
        type: haystack_integrations.components.generators.anthropic.chat.chat_generator.AnthropicChatGenerator
        init_parameters: {}
  multi_query_retriever:
    type: haystack.components.retrievers.multi_query_text_retriever.MultiQueryTextRetriever
    init_parameters:
      retriever:
        type: haystack_integrations.components.retrievers.opensearch.bm25_retriever.OpenSearchBM25Retriever
        init_parameters:
          document_store:
            type: haystack_integrations.document_stores.opensearch.document_store.OpenSearchDocumentStore
          top_k: 5

connections:
- sender: query_expander.queries
  receiver: multi_query_retriever.queries

max_runs_per_component: 100

metadata: {}

inputs:
  query:
  - query_expander.query

```

## Init Parameters

For a list of parameters you can configure, see [OpenSearchDocumentStore API reference](https://docs.haystack.deepset.ai/reference/integrations-opensearch#opensearchdocumentstore) in Haystack documentation.
