title: PHP Elastic Search Filtered Query String Search
body: <p>All would like to use the filtered query where results should contain data from the "query_string" and also from the "term - filter" applied.</p>
  
  <pre><code>GET blog/_search
  {
      "query": {
          "filtered": {
              "query": {
                  "query_string": {
                      "fields": [ "description" ],
                      "query": "a"                 // or just ""
                  }
              },
              "filter": {
                  "terms": {
                      "topic_id": [
                          10
                      ]
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>The expected result is: </p>
  
  <ol>
  <li>all blog records having letter "a" or "" in it with topic_id is 10.</li>
  <li>also rest of the records where topic_id is 10 even if the description is blank/empty.</li>
  </ol>
  
  <p>So final result should be - the matching records with higher score and should come at the top, then the records just matching the "topic_id" from  the filter.</p>