# Are the queryNorm and coord factors no longer applied to bool query scoring?

**URL:** https://discuss.elastic.co/t/are-the-querynorm-and-coord-factors-no-longer-applied-to-bool-query-scoring/82962
**Category:** Elasticsearch
**Created:** [April 19, 2017, 11:36pm UTC](https://discuss.elastic.co/t/are-the-querynorm-and-coord-factors-no-longer-applied-to-bool-query-scoring/82962 "2017-04-19T23:36:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![davidbkemp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidbkemp/32/594_2.png) [@davidbkemp](https://discuss.elastic.co/u/davidbkemp)
#### Post date: [April 19, 2017, 11:36pm UTC](https://discuss.elastic.co/t/are-the-querynorm-and-coord-factors-no-longer-applied-to-bool-query-scoring/82962/1 "2017-04-19T23:36:43Z")

</div>

Is it supposed to be the case that, as of version 5, the queryNorm and coord factors are no longer applied to the bool query scores?

In version 2, a simple bool query containing an array of two "should" sub-queries, scoring would multiply the sub-query scores by the fraction of the sub-queries that matched (i.e. apply a coord factor), and also apply some mysterious queryNorm factor. You could disable the coord factor with a flag.

In version 5, the score is simply the sum of the scores of the sub-queries that match.

Was this a deliberate change? I have tried it with versions 5.2 and 5.3.

```
POST /foo/foo/_bulk
{"index": {}}
{"a": "apple"}
{"index": {}}
{"a": "pear"}
{"index": {}}
{"a": "apple pear"}

GET /foo/foo/_search?explain=true
{
  "query": {
    "bool": {
      "should": [
        {
          "constant_score": {
            "filter": {
              "match": {
                "a": "apple"
              }
            },
            "boost": 3
          }
        },
                {
          "constant_score": {
            "filter": {
              "match": {
                "a": "pear"
              }
            },
            "boost": 4
          }
        }
      ]
    }
  }
}

```

For the above query, I get scores of 7, 4 and 3 for "apple pear", "pear", and "apple" respectively. On version 2, I get scores of 1.4, 0.4, and 0.3.

---

<div class="post-metadata">

### Author: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [April 20, 2017, 3:35am UTC](https://discuss.elastic.co/t/are-the-querynorm-and-coord-factors-no-longer-applied-to-bool-query-scoring/82962/2 "2017-04-20T03:35:35Z")

</div>

QueryNorm and coords will be removed in Lucene 7:  
[https://issues.apache.org/jira/browse/LUCENE-7347](https://issues.apache.org/jira/browse/LUCENE-7347)

What you are seeing is probably the effect of BM25 now being the default  
similarity in Lucene 6 (and therefore Elasticsearch 5.x). That said, I am  
surprised that coords are not in effect since Lucene does not implement  
BM25 to the letter. Try changing it back to the classic TDIDF similarity.

---

<div class="post-metadata">

### Author: ![davidbkemp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidbkemp/32/594_2.png) [@davidbkemp](https://discuss.elastic.co/u/davidbkemp)
#### Post date: [April 22, 2017, 7:11am UTC](https://discuss.elastic.co/t/are-the-querynorm-and-coord-factors-no-longer-applied-to-bool-query-scoring/82962/3 "2017-04-22T07:11:46Z")

</div>

You are right. If I configure the "similarity" algorithm to be the old (classic) TF/IDF, then the coord and query-norm factors are applied. This is hinted at towards the end of the section on the Similarity module where it mentions something about query-norm and coord. I think the documentation could be more clear, but I feel I still don't really know enough about how the similarity module works to suggest improvements. Anyway, thanks for the tip Ivan.

---

<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: [May 20, 2017, 7:14am UTC](https://discuss.elastic.co/t/are-the-querynorm-and-coord-factors-no-longer-applied-to-bool-query-scoring/82962/4 "2017-05-20T07:14:41Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
