title: How do I add a filter to function_score query in Elasticsearch 5
body: <p>How do I add this filter to this query below in elastic search 5.2.0. </p>
  
  <p>I tried to wrap the filter in a filtered array with no luck.</p>
  
  <p><strong>Filter</strong></p>
  
  <pre><code>"filter" : {
       "term" : { "body.category" : 1}
  }
  </code></pre>
  
  <p><strong>The query</strong></p>
  
  <pre><code>{
    "query": {
      "function_score": {
        "query": {
          "multi_match": {
            "operator": "and",
            "query": "my search",
            "fuzziness": 1,
            "fields": [
              "body.name^5",
              "body.manufacturer^33",
              "body.sections.name",
              "body.sections.parent.name",
              "body.sections.parent.parent.name"
            ]
          }
        },
        "functions": [
          {
            "field_value_factor": {
              "field": "body.rank"
            }
          }
        ],
        "score_mode": "multiply"
      }
    }
  }
  </code></pre>