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

[source, js]
----
const response = await client.search({
  index: "issues",
  query: {
    match_all: {},
  },
  aggs: {
    comments: {
      nested: {
        path: "comments",
      },
      aggs: {
        top_usernames: {
          terms: {
            field: "comments.username",
          },
          aggs: {
            comment_to_issue: {
              reverse_nested: {},
              aggs: {
                top_tags_per_comment: {
                  terms: {
                    field: "tags",
                  },
                },
              },
            },
          },
        },
      },
    },
  },
});
console.log(response);
----
