title: elasticsearch disable term frequency scoring
body: <p>I want to change the scoring system in elasticsearch to get rid of counting multiple appearances of a term.  For example, I want:</p>
  <p>&quot;texas texas texas&quot;</p>
  <p>and</p>
  <p>&quot;texas&quot;</p>
  <p>to come out as the same score.  I had found this mapping that elasticsearch said would disable term frequency counting but my searches do not come out as the same score:</p>
  <pre><code>&quot;mappings&quot;:{
  &quot;business&quot;: {   
     &quot;properties&quot; : {
         &quot;name&quot; : {
            &quot;type&quot; : &quot;string&quot;,
            &quot;index_options&quot; : &quot;docs&quot;,
            &quot;norms&quot; : { &quot;enabled&quot;: false}}
          }
      }
  }
  </code></pre>
  <p>}</p>
  <p>Any help will be appreciated, I have not been able to find a lot of information on this.</p>
  <p>I am adding my search code and what gets returned when I use explain.</p>
  <p>My search code:</p>
  <pre><code>Settings settings = ImmutableSettings.settingsBuilder().put(&quot;cluster.name&quot;, &quot;escluster&quot;).build();
      Client client = new TransportClient(settings)
      .addTransportAddress(new InetSocketTransportAddress(&quot;127.0.0.1&quot;, 9300));
  
      SearchRequest request =  Requests.searchRequest(&quot;businesses&quot;)
              .source(SearchSourceBuilder.searchSource().query(QueryBuilders.boolQuery()
              .should(QueryBuilders.matchQuery(&quot;name&quot;, &quot;Texas&quot;)
              .minimumShouldMatch(&quot;1&quot;)))).searchType(SearchType.DFS_QUERY_THEN_FETCH);
      
      ExplainRequest request2 = client.prepareIndex(&quot;businesses&quot;, &quot;business&quot;)
  </code></pre>
  <p>and when I search with explain I get:</p>
  <pre><code>  &quot;took&quot; : 14,
    &quot;timed_out&quot; : false,
    &quot;_shards&quot; : {
      &quot;total&quot; : 3,
      &quot;successful&quot; : 3,
      &quot;failed&quot; : 0
    },
    &quot;hits&quot; : {
      &quot;total&quot; : 2,
      &quot;max_score&quot; : 1.0,
      &quot;hits&quot; : [ {
        &quot;_shard&quot; : 1,
        &quot;_node&quot; : &quot;BTqBPVDET5Kr83r-CYPqfA&quot;,
        &quot;_index&quot; : &quot;businesses&quot;,
        &quot;_type&quot; : &quot;business&quot;,
        &quot;_id&quot; : &quot;AU9U5KBks4zEorv9YI4n&quot;,
        &quot;_score&quot; : 1.0,
        &quot;_source&quot;:{
  &quot;name&quot; : &quot;texas&quot;
  }
  ,
        &quot;_explanation&quot; : {
          &quot;value&quot; : 1.0,
          &quot;description&quot; : &quot;weight(_all:texas in 0) [PerFieldSimilarity], result of:&quot;,
          &quot;details&quot; : [ {
            &quot;value&quot; : 1.0,
            &quot;description&quot; : &quot;fieldWeight in 0, product of:&quot;,
            &quot;details&quot; : [ {
              &quot;value&quot; : 1.0,
              &quot;description&quot; : &quot;tf(freq=1.0), with freq of:&quot;,
              &quot;details&quot; : [ {
                &quot;value&quot; : 1.0,
                &quot;description&quot; : &quot;termFreq=1.0&quot;
              } ]
            }, {
              &quot;value&quot; : 1.0,
              &quot;description&quot; : &quot;idf(docFreq=2, maxDocs=3)&quot;
            }, {
              &quot;value&quot; : 1.0,
              &quot;description&quot; : &quot;fieldNorm(doc=0)&quot;
            } ]
          } ]
        }
      }, {
        &quot;_shard&quot; : 1,
        &quot;_node&quot; : &quot;BTqBPVDET5Kr83r-CYPqfA&quot;,
        &quot;_index&quot; : &quot;businesses&quot;,
        &quot;_type&quot; : &quot;business&quot;,
        &quot;_id&quot; : &quot;AU9U5K6Ks4zEorv9YI4o&quot;,
        &quot;_score&quot; : 0.8660254,
        &quot;_source&quot;:{
  &quot;name&quot; : &quot;texas texas texas&quot;
  }
  ,
        &quot;_explanation&quot; : {
          &quot;value&quot; : 0.8660254,
          &quot;description&quot; : &quot;weight(_all:texas in 0) [PerFieldSimilarity], result of:&quot;,
          &quot;details&quot; : [ {
            &quot;value&quot; : 0.8660254,
            &quot;description&quot; : &quot;fieldWeight in 0, product of:&quot;,
            &quot;details&quot; : [ {
              &quot;value&quot; : 1.7320508,
              &quot;description&quot; : &quot;tf(freq=3.0), with freq of:&quot;,
              &quot;details&quot; : [ {
                &quot;value&quot; : 3.0,
                &quot;description&quot; : &quot;termFreq=3.0&quot;
              } ]
            }, {
              &quot;value&quot; : 1.0,
              &quot;description&quot; : &quot;idf(docFreq=2, maxDocs=3)&quot;
            }, {
              &quot;value&quot; : 0.5,
              &quot;description&quot; : &quot;fieldNorm(doc=0)&quot;
            } ]
          } ]
        }
      } ]
    }
      
  </code></pre>
  <p>It looks like it is still considering frequency and doc frequency.  Any ideas? Sorry for the bad formatting I don't know why it is appearing so grotesque.</p>
  <p>My code from the browser search http://localhost:9200/businesses/business/_search?pretty=true&amp;qname=texas
  is:</p>
  <pre><code>    {
    &quot;took&quot; : 2,
    &quot;timed_out&quot; : false,
    &quot;_shards&quot; : {
      &quot;total&quot; : 3,
      &quot;successful&quot; : 3,
      &quot;failed&quot; : 0
    },
    &quot;hits&quot; : {
      &quot;total&quot; : 4,
      &quot;max_score&quot; : 1.0,
      &quot;hits&quot; : [ {
        &quot;_index&quot; : &quot;businesses&quot;,
        &quot;_type&quot; : &quot;business&quot;,
        &quot;_id&quot; : &quot;AU9YcCKjKvtg8NgyozGK&quot;,
        &quot;_score&quot; : 1.0,
        &quot;_source&quot;:{&quot;business&quot; : {
  &quot;name&quot; : &quot;texas texas texas texas&quot; }
  }
      }, {
        &quot;_index&quot; : &quot;businesses&quot;,
        &quot;_type&quot; : &quot;business&quot;,
        &quot;_id&quot; : &quot;AU9YateBKvtg8Ngyoy-p&quot;,
        &quot;_score&quot; : 1.0,
        &quot;_source&quot;:{
  &quot;name&quot; : &quot;texas&quot; }
  
      }, {
        &quot;_index&quot; : &quot;businesses&quot;,
        &quot;_type&quot; : &quot;business&quot;,
        &quot;_id&quot; : &quot;AU9YavVnKvtg8Ngyoy-4&quot;,
        &quot;_score&quot; : 1.0,
        &quot;_source&quot;:{
  &quot;name&quot; : &quot;texas texas texas&quot; }
  
      }, {
        &quot;_index&quot; : &quot;businesses&quot;,
        &quot;_type&quot; : &quot;business&quot;,
        &quot;_id&quot; : &quot;AU9Yb7NgKvtg8NgyozFf&quot;,
        &quot;_score&quot; : 1.0,
        &quot;_source&quot;:{&quot;business&quot; : {
  &quot;name&quot; : &quot;texas texas texas&quot; }
  }
      } ]
    }
  }
  </code></pre>
  <p>It finds all 4 objects I have in there and has them all the same score.
  When I run my java API search with explain I get:</p>
  <pre><code>    {
    &quot;took&quot; : 2,
    &quot;timed_out&quot; : false,
    &quot;_shards&quot; : {
      &quot;total&quot; : 3,
      &quot;successful&quot; : 3,
      &quot;failed&quot; : 0
    },
    &quot;hits&quot; : {
      &quot;total&quot; : 2,
      &quot;max_score&quot; : 1.287682,
      &quot;hits&quot; : [ {
        &quot;_shard&quot; : 1,
        &quot;_node&quot; : &quot;BTqBPVDET5Kr83r-CYPqfA&quot;,
        &quot;_index&quot; : &quot;businesses&quot;,
        &quot;_type&quot; : &quot;business&quot;,
        &quot;_id&quot; : &quot;AU9YateBKvtg8Ngyoy-p&quot;,
        &quot;_score&quot; : 1.287682,
        &quot;_source&quot;:{
  &quot;name&quot; : &quot;texas&quot; }
  ,
        &quot;_explanation&quot; : {
          &quot;value&quot; : 1.287682,
          &quot;description&quot; : &quot;weight(name:texas in 0) [PerFieldSimilarity], result of:&quot;,
          &quot;details&quot; : [ {
            &quot;value&quot; : 1.287682,
            &quot;description&quot; : &quot;fieldWeight in 0, product of:&quot;,
            &quot;details&quot; : [ {
              &quot;value&quot; : 1.0,
              &quot;description&quot; : &quot;tf(freq=1.0), with freq of:&quot;,
              &quot;details&quot; : [ {
                &quot;value&quot; : 1.0,
                &quot;description&quot; : &quot;termFreq=1.0&quot;
              } ]
            }, {
              &quot;value&quot; : 1.287682,
              &quot;description&quot; : &quot;idf(docFreq=2, maxDocs=4)&quot;
            }, {
              &quot;value&quot; : 1.0,
              &quot;description&quot; : &quot;fieldNorm(doc=0)&quot;
            } ]
          } ]
        }
      }, {
        &quot;_shard&quot; : 1,
        &quot;_node&quot; : &quot;BTqBPVDET5Kr83r-CYPqfA&quot;,
        &quot;_index&quot; : &quot;businesses&quot;,
        &quot;_type&quot; : &quot;business&quot;,
        &quot;_id&quot; : &quot;AU9YavVnKvtg8Ngyoy-4&quot;,
        &quot;_score&quot; : 1.1151654,
        &quot;_source&quot;:{
  &quot;name&quot; : &quot;texas texas texas&quot; }
  ,
        &quot;_explanation&quot; : {
          &quot;value&quot; : 1.1151654,
          &quot;description&quot; : &quot;weight(name:texas in 0) [PerFieldSimilarity], result of:&quot;,
          &quot;details&quot; : [ {
            &quot;value&quot; : 1.1151654,
            &quot;description&quot; : &quot;fieldWeight in 0, product of:&quot;,
            &quot;details&quot; : [ {
              &quot;value&quot; : 1.7320508,
              &quot;description&quot; : &quot;tf(freq=3.0), with freq of:&quot;,
              &quot;details&quot; : [ {
                &quot;value&quot; : 3.0,
                &quot;description&quot; : &quot;termFreq=3.0&quot;
              } ]
            }, {
              &quot;value&quot; : 1.287682,
              &quot;description&quot; : &quot;idf(docFreq=2, maxDocs=4)&quot;
            }, {
              &quot;value&quot; : 0.5,
              &quot;description&quot; : &quot;fieldNorm(doc=0)&quot;
            } ]
          } ]
        }
      } ]
    }
  }
  </code></pre>