# Change default similarity to BM25 for all fields

**URL:** https://discuss.elastic.co/t/change-default-similarity-to-bm25-for-all-fields/12212
**Category:** Elasticsearch
**Created:** [May 31, 2013, 6:00pm UTC](https://discuss.elastic.co/t/change-default-similarity-to-bm25-for-all-fields/12212 "2013-05-31T18:00:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Aecio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aecio/32/2403_2.png) [@Aecio](https://discuss.elastic.co/u/Aecio)
#### Post date: [May 31, 2013, 6:00pm UTC](https://discuss.elastic.co/t/change-default-similarity-to-bm25-for-all-fields/12212/1 "2013-05-31T18:00:45Z")

</div>

How can I change Elastic Search to use BM25 sinstead of the default tf-idf  
similarity for all fields of my index? I the docs, I could find only how to  
set the the similarity per field using the put mapping API. I would like  
that Elastic Search use BM25 if I don't explicitly define a similarity. Is  
that possible?

Aécio Santos

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Aecio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aecio/32/2403_2.png) [@Aecio](https://discuss.elastic.co/u/Aecio)
#### Post date: [June 3, 2013, 2:47pm UTC](https://discuss.elastic.co/t/change-default-similarity-to-bm25-for-all-fields/12212/2 "2013-06-03T14:47:51Z")

</div>

Just found that adding the following line in config/elasticsearch.yml works  
(at least when using "explain: true", the parameters of BM25 similartity  
are shown in the score explanation).

index.similarity.default.type: BM25

Maybe this should be added in the documentation of the similarity module:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

2013/5/31 Aécio [aecio.solando@gmail.com](mailto:aecio.solando@gmail.com)

> How can I change Elastic Search to use BM25 sinstead of the default tf-idf  
> similarity for all fields of my index? I the docs, I could find only how to  
> set the the similarity per field using the put mapping API. I would like  
> that Elastic Search use BM25 if I don't explicitly define a similarity. Is  
> that possible?
> 
> Aécio Santos

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [June 4, 2013, 9:33am UTC](https://discuss.elastic.co/t/change-default-similarity-to-bm25-for-all-fields/12212/3 "2013-06-04T09:33:49Z")

</div>

Hey,

it is actually documented in the last paragraph, but we have to improve  
here. Please open a github issue at  
[https://github.com/elasticsearch/elasticsearch.github.com](https://github.com/elasticsearch/elasticsearch.github.com) if you find  
problems like this, so we do not forget it...

--Alex

On Mon, Jun 3, 2013 at 4:47 PM, Aécio [aecio.solando@gmail.com](mailto:aecio.solando@gmail.com) wrote:

> Just found that adding the following line in config/elasticsearch.yml  
> works (at least when using "explain: true", the parameters of BM25  
> similartity are shown in the score explanation).
> 
> index.similarity.default.type: BM25
> 
> Maybe this should be added in the documentation of the similarity module:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/similarity/)
> 
> 2013/5/31 Aécio [aecio.solando@gmail.com](mailto:aecio.solando@gmail.com)
> 
> > How can I change Elastic Search to use BM25 sinstead of the default  
> > tf-idf similarity for all fields of my index? I the docs, I could find only  
> > how to set the the similarity per field using the put mapping API. I would  
> > like that Elastic Search use BM25 if I don't explicitly define a  
> > similarity. Is that possible?
> > 
> > Aécio Santos
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:33am UTC](https://discuss.elastic.co/t/change-default-similarity-to-bm25-for-all-fields/12212/4 "2017-07-06T02:33:07Z")

</div>


