title: Function score with filters elasticsearch
body: <p>I want to have a function, that takes all the results and only orders them if they match the filters.
  I've tried with these queries but no result. Can someone help with this?</p>
  
  <p>Tryout 1:</p>
  
  <pre><code>{
             "query": {
                  "function_score": {
                      "query": {
                          "filtered": {
                              "query": {
                                  "match_all": {} 
                              },                        
                              "filter": {
                                  "bool": {
                                      "must": [
                                          {
                                              "term": {
                                                  "category_boats": "motor_boat"
                                              }
                                          }                                           
                                      ]
                                  }
                              }
                          }
                      },
                      "functions": [
  
                      ],
                      "score_mode": "first"
                  }
              }
          }
  </code></pre>
  
  <p>Tryout 2:</p>
  
  <pre><code>{
             "query": {
                  "function_score": {
                      "query": { 
                          "match_all": {}
                      },
                      "functions": [ 
                          {
                              "filter": { 
                                  "term": { 
                                      "boat_type": "offshore_yacht" 
                                  }
                              }, 
                              "weight": 1
                          },
                          {
                              "filter": { 
                                  "term": { 
                                      "year_built": "2016" 
                                  }
                              }, 
                              "weight": 1
                          },
                          {
                              "filter": { 
                                  "term": { 
                                      "manufacturer": "MasterCraft" 
                                  }
                              }, 
                              "weight": 2 
                          }
                      ],
                      "score_mode": "first"
                  }
              }
          }
  </code></pre>
  
  <p>On the last code I get an error: No function with the name [weight] is registered.]
  So is weight for filter supported or not? Some help?</p>