anchor.diff:  
   //////////////////////////
   
  -[source,js]
  +[source,console]
   --------------------------------------------------
   PUT /products
   {
  
positive.code: [[search-aggregations-bucket-terms-aggregation-script]]
  ==== Script
  
  Generating the terms using a script:
  
  [source,console,id=terms-aggregation-script-example]
  --------------------------------------------------
  GET /_search
  {
    "aggs": {
      "genres": {
        "terms": {
          "script": {
            "source": "doc['genre'].value",
            "lang": "painless"
          }
        }
      }
    }
  }
  --------------------------------------------------
  
  This will interpret the `script` parameter as an `inline` script with the default script language and no script parameters. To use a stored script use the following syntax:
  
  //////////////////////////
  
  [source,console,id=terms-aggregation-stored-example]
  --------------------------------------------------
  POST /_scripts/my_script
  {
    "script": {
      "lang": "painless",
      "source": "doc[params.field].value"
    }
  }
  --------------------------------------------------
  
  //////////////////////////
  
  [source,console]
  --------------------------------------------------
  GET /_search
  {
    "aggs": {
      "genres": {
        "terms": {
          "script": {
            "id": "my_script",
            "params": {
              "field": "genre"
            }
          }
        }
      }
    }
  }
  --------------------------------------------------
  // TEST[continued]
  
  ==== Value Script
  
  [source,console,id=terms-aggregation-value-script-example]
  --------------------------------------------------
  GET /_search
  {
    "aggs": {
      "genres": {
        "terms": {
          "field": "genre",
          "script": {
            "source": "'Genre: ' +_value",
            "lang": "painless"
          }
        }
      }
    }
  }
  --------------------------------------------------
  
  ==== Filtering Values
  
  
negative.code: {"index":{"_id":0}}
  {"genre": "rock", "product": "Product A"}
  {"index":{"_id":1}}
  {"genre": "rock", "product": "Product B"}
  {"index":{"_id":2}}
  {"genre": "rock", "product": "Product C"}
  {"index":{"_id":3}}
  {"genre": "jazz", "product": "Product D"}
  {"index":{"_id":4}}
  {"genre": "jazz", "product": "Product E"}
  {"index":{"_id":5}}
  {"genre": "electronic", "product": "Anthology A"}
  {"index":{"_id":6}}
  {"genre": "electronic", "product": "Anthology A"}
  {"index":{"_id":7}}
  {"genre": "electronic", "product": "Product F"}
  {"index":{"_id":8}}
  {"genre": "electronic", "product": "Product G"}
  {"index":{"_id":9}}
  {"genre": "electronic", "product": "Product H"}
  {"index":{"_id":10}}
  {"genre": "electronic", "product": "Product I"}
  -------------------------------------------------
  // TESTSETUP
  
  //////////////////////////
  