# fieldNorm & queryNorm in explain api

**URL:** <https://discuss.elastic.co/t/fieldnorm-querynorm-in-explain-api/15747>\
**Category:** Elasticsearch\
**Created:** [February 12, 2014, 5:32am UTC](https://discuss.elastic.co/t/fieldnorm-querynorm-in-explain-api/15747 "2014-02-12T05:32:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![usha2626](https://avatars.discourse-cdn.com/v4/letter/u/4bbf92/32.png) [@usha2626](https://discuss.elastic.co/u/usha2626)\
**Post date:** [February 12, 2014, 5:32am UTC](https://discuss.elastic.co/t/fieldnorm-querynorm-in-explain-api/15747/1 "2014-02-12T05:32:43Z")

</div>

Hi,

I want to know what are fieldNorm and queryNorm in the output displayed by  
the explain api..how are they calculated?

Thanks  
Usha

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a009d8bd-6646-492e-8dc0-1af682a78286%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a009d8bd-6646-492e-8dc0-1af682a78286%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [February 12, 2014, 6:30am UTC](https://discuss.elastic.co/t/fieldnorm-querynorm-in-explain-api/15747/2 "2014-02-12T06:30:03Z")

</div>

The norms are calculated by Lucene's TFIDF algorithm:  
[http://lucene.apache.org/core/4\_6\_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html](http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html)

The field norm is encoded into a single byte, so there is a loss of  
precision.

--  
Ivan

On Tue, Feb 11, 2014 at 9:32 PM, [usha2626@gmail.com](mailto:usha2626@gmail.com) wrote:

> Hi,
> 
> I want to know what are fieldNorm and queryNorm in the output displayed by  
> the explain api..how are they calculated?
> 
> Thanks  
> Usha
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/a009d8bd-6646-492e-8dc0-1af682a78286%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a009d8bd-6646-492e-8dc0-1af682a78286%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAzhPuEZ9H%2BN0pnC-xmWvscxitDie4%3DSVtjus\_B%2Bp8GDA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAzhPuEZ9H%2BN0pnC-xmWvscxitDie4%3DSVtjus_B%2Bp8GDA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Navneet\_Mathpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navneet_mathpal/32/3677_2.png) [@Navneet\_Mathpal](https://discuss.elastic.co/u/Navneet_Mathpal)\
**Post date:** [February 12, 2014, 7:56am UTC](https://discuss.elastic.co/t/fieldnorm-querynorm-in-explain-api/15747/3 "2014-02-12T07:56:56Z")

</div>

Ivan  
formula is queryNorm(q) = queryNorm(sumOfSquaredWeights)[http://lucene.apache.org/core/4\_6\_0/core/org/apache/lucene/search/similarities/DefaultSimilarity.html#queryNorm(float)](http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/similarities/DefaultSimilarity.html#queryNorm%28float%29) =  
1 –––––––––––––– sumOfSquaredWeights½

The sum of squared weights (of the query terms) is computed by the query  
Weight[http://lucene.apache.org/core/4\_6\_0/core/org/apache/lucene/search/Weight.html](http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/Weight.html)object. For example, a  
BooleanQuery[http://lucene.apache.org/core/4\_6\_0/core/org/apache/lucene/search/BooleanQuery.html](http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/BooleanQuery.html)computes this value as:

sumOfSquaredWeights[http://lucene.apache.org/core/4\_6\_0/core/org/apache/lucene/search/Weight.html#getValueForNormalization()](http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/Weight.html#getValueForNormalization%28%29) =  
q.getBoost()[http://lucene.apache.org/core/4\_6\_0/core/org/apache/lucene/search/Query.html#getBoost()](http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/Query.html#getBoost%28%29)  
2 · ∑ ( idf(t)[http://lucene.apache.org/core/4\_6\_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html#formula\_idf](http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html#formula_idf) ·  
t.getBoost()[http://lucene.apache.org/core/4\_6\_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html#formula\_termBoost](http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html#formula_termBoost) )  
2  
t in q

for my following search result how it is calculating:

{

- took: 16
- timed\_out: false
- \_shards: {
  - total: 5
  - successful: 5
  - failed: 0  
}

- hits: {
  - total: 2
  - max\_score: 0.2712221
  - hits: [
    - {
      - \_shard: 3
      - \_node: k8BXmkARRsaaYlUJTRpIqQ
      - \_index: phone
      - \_type: iphone
      - \_id: 2
      - \_score: 0.2712221
      - \_source: {
        - title: iphone update
        - description: this section shows how to update yopur iphone  
to work smoothly in your iphone  
}

      - \_explanation: {
        - value: 0.27122214
        - description: max of:
        - details: [
          - {
            - value: 0.27122214
            - description: sum of:
            - details: [
              - {
                - value: 0.13561107
                - description: weight(title:iphone in 0)  
[PerFieldSimilarity], result of:
                - details: [
                  - {
                    - value: 0.13561107
                    - description: score(doc=0,freq=1.0 =  
termFreq=1.0 ), product of:
                    - details: [
                      - {
                        - value: 0.70710677
                        - description: queryWeight, product  
of:
                        - details: [
                          - {
                            - value: 0.30685282
                            - description: idf(docFreq=1,  
maxDocs=1)  
}

                          - {
                            - value: 2.3043842
                            - description: queryNorm  
}  
]  
}

                      - {
                        - value: 0.19178301
                        - description: fieldWeight in 0,  
product of:
                        - details: [
                          - {
                            - value: 1
                            - description: tf(freq=1.0),  
with freq of:
                            - details: [
                              - {
                                - value: 1
                                - description:  
termFreq=1.0  
}  
]  
}

                          - {
                            - value: 0.30685282
                            - description: idf(docFreq=1,  
maxDocs=1)  
}

                          - {
                            - value: 0.625
                            - description: fieldNorm(doc=0)  
}  
]  
}  
]  
}  
]  
}

              - {
                - value: 0.13561107
                - description: weight(title:update in 0)  
[PerFieldSimilarity], result of:
                - details: [
                  - {
                    - value: 0.13561107
                    - description: score(doc=0,freq=1.0 =  
termFreq=1.0 ), product of:
                    - details: [
                      - {
                        - value: 0.70710677
                        - description: queryWeight, product  
of:
                        - details: [
                          - {
                            - value: 0.30685282
                            - description: idf(docFreq=1,  
maxDocs=1)  
}

                          - {
                            - value: 2.3043842
                            - description: queryNorm  
}  
]  
}

                      - {
                        - value: 0.19178301
                        - description: fieldWeight in 0,  
product of:
                        - details: [
                          - {
                            - value: 1
                            - description: tf(freq=1.0),  
with freq of:
                            - details: [
                              - {
                                - value: 1
                                - description:  
termFreq=1.0  
}  
]  
}

                          - {
                            - value: 0.30685282
                            - description: idf(docFreq=1,  
maxDocs=1)  
}

                          - {
                            - value: 0.625
                            - description: fieldNorm(doc=0)  
}  
]  
}  
]  
}  
]  
}  
]  
}

          - {
            - value: 0.16369703
            - description: sum of:
            - details: [
              - {
                - value: 0.0958915
                - description: weight(description:iphone in 0)  
[PerFieldSimilarity], result of:
                - details: [
                  - {
                    - value: 0.0958915
                    - description: score(doc=0,freq=2.0 =  
termFreq=2.0 ), product of:
                    - details: [
                      - {
                        - value: 0.70710677
                        - description: queryWeight, product  
of:
                        - details: [
                          - {
                            - value: 0.30685282
                            - description: idf(docFreq=1,  
maxDocs=1)  
}

                          - {
                            - value: 2.3043842
                            - description: queryNorm  
}  
]  
}

                      - {
                        - value: 0.13561106
                        - description: fieldWeight in 0,  
product of:
                        - details: [
                          - {
                            - value: 1.4142135
                            - description: tf(freq=2.0),  
with freq of:
                            - details: [
                              - {
                                - value: 2
                                - description:  
termFreq=2.0  
}  
]  
}

                          - {
                            - value: 0.30685282
                            - description: idf(docFreq=1,  
maxDocs=1)  
}

                          - {
                            - value: 0.3125
                            - description: fieldNorm(doc=0)  
}  
]  
}  
]  
}  
]  
}

              - {
                - value: 0.067805536
                - description: weight(description:update in 0)  
[PerFieldSimilarity], result of:
                - details: [
                  - {
                    - value: 0.067805536
                    - description: score(doc=0,freq=1.0 =  
termFreq=1.0 ), product of:
                    - details: [
                      - {
                        - value: 0.70710677
                        - description: queryWeight, product  
of:
                        - details: [
                          - {
                            - value: 0.30685282
                            - description: idf(docFreq=1,  
maxDocs=1)  
}

                          - {
                            - value: 2.3043842
                            - description: queryNorm  
}  
]  
}

                      - {
                        - value: 0.095891505
                        - description: fieldWeight in 0,  
product of:
                        - details: [
                          - {
                            - value: 1
                            - description: tf(freq=1.0),  
with freq of:
                            - details: [
                              - {
                                - value: 1
                                - description:  
termFreq=1.0  
}  
]  
}

                          - {
                            - value: 0.30685282
                            - description: idf(docFreq=1,  
maxDocs=1)  
}

                          - {
                            - value: 0.3125
                            - description: fieldNorm(doc=0)  
}  
]  
}  
]  
}  
]  
}  
]  
}  
]  
}  
}

    - {
      - \_shard: 2
      - \_node: k8BXmkARRsaaYlUJTRpIqQ
      - \_index: phone
      - \_type: iphone
      - \_id: 1
      - \_score: 0.04500804
      - \_source: {
        - title: iphone
        - description: welcome to iphone world  
}

      - \_explanation: {
        - value: 0.04500804
        - description: max of:
        - details: [
          - {
            - value: 0.04500804
            - description: product of:
            - details: [
              - {
                - value: 0.09001608
                - description: sum of:
                - details: [
                  - {
                    - value: 0.09001608
                    - description: weight(title:iphone in 0)  
[PerFieldSimilarity], result of:
                    - details: [
                      - {
                        - value: 0.09001608
                        - description: score(doc=0,freq=1.0  
= termFreq=1.0 ), product of:
                        - details: [
                          - {
                            - value: 0.29335263
                            - description: queryWeight,  
product of:
                            - details: [
                              - {
                                - value: 0.30685282
                                - description: idf(docFreq=1,  
maxDocs=1)  
}

                              - {
                                - value: 0.9560043
                                - description: queryNorm  
}  
]  
}

                          - {
                            - value: 0.30685282
                            - description: fieldWeight in  
0, product of:
                            - details: [
                              - {
                                - value: 1
                                - description: tf(freq=1.0),  
with freq of:
                                - details: [
                                  - {
                                    - value: 1
                                    - description:  
termFreq=1.0  
}  
]  
}

                              - {
                                - value: 0.30685282
                                - description: idf(docFreq=1,  
maxDocs=1)  
}

                              - {
                                - value: 1
                                - description:  
fieldNorm(doc=0)  
}  
]  
}  
]  
}  
]  
}  
]  
}

              - {
                - value: 0.5
                - description: coord(1/2)  
}  
]  
}

          - {
            - value: 0.02250402
            - description: product of:
            - details: [
              - {
                - value: 0.04500804
                - description: sum of:
                - details: [
                  - {
                    - value: 0.04500804
                    - description: weight(description:iphone  
in 0) [PerFieldSimilarity], result of:
                    - details: [
                      - {
                        - value: 0.04500804
                        - description: score(doc=0,freq=1.0  
= termFreq=1.0 ), product of:
                        - details: [
                          - {
                            - value: 0.29335263
                            - description: queryWeight,  
product of:
                            - details: [
                              - {
                                - value: 0.30685282
                                - description: idf(docFreq=1,  
maxDocs=1)  
}

                              - {
                                - value: 0.9560043
                                - description: queryNorm  
}  
]  
}

                          - {
                            - value: 0.15342641
                            - description: fieldWeight in  
0, product of:
                            - details: [
                              - {
                                - value: 1
                                - description: tf(freq=1.0),  
with freq of:
                                - details: [
                                  - {
                                    - value: 1
                                    - description:  
termFreq=1.0  
}  
]  
}

                              - {
                                - value: 0.30685282
                                - description: idf(docFreq=1,  
maxDocs=1)  
}

                              - {
                                - value: 0.5
                                - description:  
fieldNorm(doc=0)  
}  
]  
}  
]  
}  
]  
}  
]  
}

              - {
                - value: 0.5
                - description: coord(1/2)  
}  
]  
}  
]  
}  
}  
]  
}

}

On Wednesday, 12 February 2014 12:00:03 UTC+5:30, Ivan Brusic wrote:

> The norms are calculated by Lucene's TFIDF algorithm:  
> [TFIDFSimilarity (Lucene 4.6.0 API)](http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html)
> 
> The field norm is encoded into a single byte, so there is a loss of  
> precision.
> 
> --  
> Ivan
> 
> On Tue, Feb 11, 2014 at 9:32 PM, \<[usha...@gmail.com](mailto:usha...@gmail.com) \<javascript:\>\> wrote:
> 
> > Hi,
> > 
> > I want to know what are fieldNorm and queryNorm in the output displayed  
> > by the explain api..how are they calculated?
> > 
> > Thanks  
> > Usha
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/a009d8bd-6646-492e-8dc0-1af682a78286%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a009d8bd-6646-492e-8dc0-1af682a78286%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4d86972e-6cca-488f-97d2-e9a1edef752f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4d86972e-6cca-488f-97d2-e9a1edef752f%40googlegroups.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, 1:50am UTC](https://discuss.elastic.co/t/fieldnorm-querynorm-in-explain-api/15747/4 "2017-07-06T01:50:49Z")

</div>


