// 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({
  size: 0,
  aggs: {
    expired_sessions: {
      terms: {
        field: "account_id",
        include: {
          partition: 0,
          num_partitions: 20,
        },
        size: 10000,
        order: {
          last_access: "asc",
        },
      },
      aggs: {
        last_access: {
          max: {
            field: "access_date",
          },
        },
      },
    },
  },
});
console.log(response);
----
