// 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.bulk({
  index: "test",
  refresh: "true",
  operations: [
    {
      index: {
        _index: "test1",
      },
    },
    {
      s: 1,
      m: 3.1415,
    },
    {
      index: {
        _index: "test1",
      },
    },
    {
      s: 2,
      m: 1,
    },
    {
      index: {
        _index: "test2",
      },
    },
    {
      s: 3.1,
      m: 2.71828,
    },
  ],
});
console.log(response);

const response1 = await client.search({
  index: "test*",
  filter_path: "aggregations",
  aggs: {
    tm: {
      top_metrics: {
        metrics: {
          field: "m",
        },
        sort: {
          s: "asc",
        },
      },
    },
  },
});
console.log(response1);
----
