title: ElasticSearch default scoring mechanism
body: <p>What I am looking for, is plain, clear explanation, of how default scoring mechanism of ElasticSearch (Lucene) really works. I mean, does it use Lucene scoring, or maybe it uses scoring of its own? </p>
  
  <p>For example, I want to search for document by, for example, "Name" field. I use .NET NEST client to write my queries. Let's consider this type of query:</p>
  
  <pre class="lang-cs prettyprint-override"><code>IQueryResponse&lt;SomeEntity&gt; queryResult = client.Search&lt;SomeEntity&gt;(s =&gt;
      s.From(0)
     .Size(300)
     .Explain()
     .Query(q =&gt; q.Match(a =&gt; a.OnField(q.Resolve(f =&gt; f.Name)).QueryString("ExampleName")))
  );
  </code></pre>
  
  <p>which is translated to such JSON query:</p>
  
  <pre><code>{
   "from": 0,
   "size": 300,
   "explain": true,
   "query": {
     "match": {
       "Name": {
         "query": "ExampleName"
        }
      }
    }
  }
  </code></pre>
  
  <p>There is about 1.1 million documents that search is performed on. What I get in return, is (that is only part of the result, formatted on my own):</p>
  
  <pre><code>650   "ExampleName" 7,313398
  
  651   "ExampleName" 7,313398
  
  652   "ExampleName" 7,313398
  
  653   "ExampleName" 7,239194
  
  654   "ExampleName" 7,239194
  
  860   "ExampleName of Something" 4,5708737  
  </code></pre>
  
  <p>where first field is just an Id, second is Name field on which ElasticSearch performed it's searching, and third is score. </p>
  
  <p>As you can see, there are many duplicates in ES index. As some of found documents have diffrent score, despite that they are exactly the same (with only diffrent Id), I concluded that diffrent shards performed searching on diffrent parts of whole dataset, which leads me to trail that the score is somewhat based on overall data in given shard, not exclusively on document that is actually considered by search engine. </p>
  
  <p>The question is, how exactly does this scoring work? I mean, could you tell me/show me/point me to exact formula to calculate score for each document found by ES? And eventually, how this scoring mechanism can be changed?</p>