# Vector space model reflected in practical scoring function

**URL:** https://discuss.elastic.co/t/vector-space-model-reflected-in-practical-scoring-function/32677
**Category:** Elasticsearch
**Created:** [October 21, 2015, 2:14pm UTC](https://discuss.elastic.co/t/vector-space-model-reflected-in-practical-scoring-function/32677 "2015-10-21T14:14:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Quitta](https://avatars.discourse-cdn.com/v4/letter/q/c5a1d2/32.png) [@Quitta](https://discuss.elastic.co/u/Quitta)
#### Post date: [October 21, 2015, 2:14pm UTC](https://discuss.elastic.co/t/vector-space-model-reflected-in-practical-scoring-function/32677/1 "2015-10-21T14:14:19Z")

</div>

Hi, I'm new to ElasticSearch.

I read that ElasticSearch combines the boolean and the vector space  
model at the following [page](https://www.elastic.co/guide/en/elasticsearch/guide/current/scoring-theory.html).

I know that one can measure the angle between the query vector and the document vector in order to assign a relevance score to each document. I believe this formula is also called the **cosine**  
**similarity** , right?

However, if I inspect the practical scoring function I don't see how the cosine similarity is present.

I believe the summation of **tf_idf^2_boost\*norm** part for each term  
represents **dot product** of the [cosine similarity](https://en.wikipedia.org/wiki/Cosine_similarity).

The **queryNorm(q)** must then represents the **denominator**. However the formula for the queryNorm seems to be 1/sqrt(sumOfSquaredWeights), where the sumOfSquaredWeights is calculated by adding together the IDF of each term in the query, squared. However this will only consider the terms present in the query. In the formula of the cosine similarity it also takes into account the terms in the document.

The cosine similarity returns a value between 0-1 (where 1 is a 100% match), why is this not the case  
for ElasticSearch? How does it then use the vector space model?

Thanks in advance,

kind regards

Quitta

---

<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:43pm UTC](https://discuss.elastic.co/t/vector-space-model-reflected-in-practical-scoring-function/32677/2 "2017-07-05T23:43:31Z")

</div>


