# Use IDF from \_all field across other fields

**URL:** https://discuss.elastic.co/t/use-idf-from--all-field-across-other-fields/37629
**Category:** Elasticsearch
**Created:** [December 19, 2015, 6:40pm UTC](https://discuss.elastic.co/t/use-idf-from--all-field-across-other-fields/37629 "2015-12-19T18:40:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ndaley](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@ndaley](https://discuss.elastic.co/u/ndaley)
#### Post date: [December 19, 2015, 6:40pm UTC](https://discuss.elastic.co/t/use-idf-from--all-field-across-other-fields/37629/1 "2015-12-19T18:40:57Z")

</div>

It seems that IDF is computed per token per field. We would like it to be computed just per token so that the same IDF will be used in each field of the document to compute the final score. The \_all field already has this ideal IDF that we would like to apply to all fields. How can this be achieved with ElasticSearch using the MultiMatch query?

Many thanks,  
Nige

---

<div class="post-metadata">

### Author: ![softwaredoug](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/softwaredoug/32/22681_2.png) [@softwaredoug](https://discuss.elastic.co/u/softwaredoug)
#### Post date: [December 19, 2015, 7:44pm UTC](https://discuss.elastic.co/t/use-idf-from--all-field-across-other-fields/37629/2 "2015-12-19T19:44:16Z")

</div>

You might want to check out cross\_field search. It blends doc freq across  
fields with identical analyzers  
[https://www.elastic.co/guide/en/elasticsearch/guide/current/\_cross\_fields\_queries.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/_cross_fields_queries.html)

I've also written about it a lot

> **[Elasticsearch Cross Field Search Is A Lie](http://opensourceconnections.com/blog/2015/03/19/elasticsearch-cross-field-search-is-a-lie/)**
>
> In Elasticsearch, searching across multiple fields can be confusing to beginners. This is a tough first step in creating a relevant search solution, so it’s ...

  

> **[Deep Dive into Elasticsearch Cross Field Search](http://opensourceconnections.com/blog/2015/05/27/deep-dive-into-elasticsearch-cross-field-search/)**
>
> Elasticsearch cross-fields are a great feature. They let you blend multiple fields scores together on a search-term by search-term basis. I covered the motiv...

---

<div class="post-metadata">

### Author: ![gihan](https://avatars.discourse-cdn.com/v4/letter/g/6bbea6/32.png) [@gihan](https://discuss.elastic.co/u/gihan)
#### Post date: [December 22, 2015, 10:57pm UTC](https://discuss.elastic.co/t/use-idf-from--all-field-across-other-fields/37629/3 "2015-12-22T22:57:02Z")

</div>

Many thanks for the reply and the links to `cross_field` query articles.

We want to query 3 fields and find the single best-matching field but use the same IDF across all 3 fields when calculating the score from the best-matching field. Will multi-match with `cross_field` achieve this objective?

We would also like exact matches to rank higher.

---

<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 5, 2017, 11:29pm UTC](https://discuss.elastic.co/t/use-idf-from--all-field-across-other-fields/37629/4 "2017-07-05T23:29:11Z")

</div>


