title: Is there performance difference between constant_score and bool query using filter?
body: <p>When it comes to the "performance difference", I read nothing reliable till now. </p>
  
  <p>Based on its official docs, as to filter used in the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-bool-query.html" rel="nofollow noreferrer">bool query</a></p>
  
  <blockquote>
    <p>The clause (query) must appear in matching documents. However unlike must <strong>the score of the query will be ignored</strong>. Filter clauses are executed in filter context, meaning that scoring is ignored and clauses are considered for <strong>caching</strong>.</p>
  </blockquote>
  
  <p>As for <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-constant-score-query.html" rel="nofollow noreferrer">constant score query</a></p>
  
  <blockquote>
    <p>Filter queries <strong>do not calculate</strong> relevance scores. To speed up performance, Elasticsearch automatically <strong>caches</strong> frequently used filter queries.</p>
  </blockquote>
  
  <hr>
  
  <h3>Just a guess</h3>
  
  <p>Constant query will not calculate (TF-IDF or more advanced algs), while the bool query will do the calculation but return 0 (ignoring it); so the constant query is more performant.</p>
  
  <p>Besides when it comes to a specified score, you have to use constant score query instead of bool query which only will return 0.</p>
  
  <p>QAs I just read: <a href="https://stackoverflow.com/questions/51142871/elasticsearch-constant-score-query-vs-bool-filter-query">Elasticsearch : constant_score query vs bool.filter query</a></p>