// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples

[source, js]
----
const response = await client.search({
  index: 'sales',
  size: '0',
  body: {
    aggs: {
      t_shirts: {
        filter: {
          term: {
            type: 't-shirt'
          }
        },
        aggs: {
          avg_price: {
            avg: {
              field: 'price'
            }
          }
        }
      }
    }
  }
})
console.log(response)
----

