# ElasticSearchBM25Retriever

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/retrievers/elastic_search_bm25/ElasticSearchBM25Retriever)

`Elasticsearch` retriever that uses `BM25`.

To connect to an Elasticsearch instance that requires login credentials,
including Elastic Cloud, use the Elasticsearch URL format
https://username:password@es_host:9243. For example, to connect to Elastic
Cloud, create the Elasticsearch URL with the required authentication details and
pass it to the ElasticVectorSearch constructor as the named parameter
elasticsearch_url.

You can obtain your Elastic Cloud URL and login credentials by logging in to the
Elastic Cloud console at https://cloud.elastic.co, selecting your deployment, and
navigating to the "Deployments" page.

To obtain your Elastic Cloud password for the default "elastic" user:

1. Log in to the Elastic Cloud console at https://cloud.elastic.co
2. Go to "Security" > "Users"
3. Locate the "elastic" user and click "Edit"
4. Click "Reset password"
5. Follow the prompts to reset the password

The format for Elastic Cloud URLs is
https://username:password@cluster_id.region_id.gcp.cloud.es.io:9243.

## Signature

```python
ElasticSearchBM25Retriever()
```

## Extends

- `BaseRetriever`

## Properties

- `client`
- `index_name`

## Methods

- [`create()`](https://reference.langchain.com/python/langchain-community/retrievers/elastic_search_bm25/ElasticSearchBM25Retriever/create)
- [`add_texts()`](https://reference.langchain.com/python/langchain-community/retrievers/elastic_search_bm25/ElasticSearchBM25Retriever/add_texts)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/retrievers/elastic_search_bm25.py#L13)