// 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: "kibana_sample_data_logs",
  size: 0,
  aggs: {
    client_ip: {
      composite: {
        sources: [
          {
            client_ip: {
              terms: {
                field: "clientip",
              },
            },
          },
        ],
      },
      aggs: {
        url_dc: {
          cardinality: {
            field: "url.keyword",
          },
        },
        bytes_sum: {
          sum: {
            field: "bytes",
          },
        },
        geo_src_dc: {
          cardinality: {
            field: "geo.src",
          },
        },
        geo_dest_dc: {
          cardinality: {
            field: "geo.dest",
          },
        },
        responses_total: {
          value_count: {
            field: "timestamp",
          },
        },
        success: {
          filter: {
            term: {
              response: "200",
            },
          },
        },
        error404: {
          filter: {
            term: {
              response: "404",
            },
          },
        },
        error503: {
          filter: {
            term: {
              response: "503",
            },
          },
        },
        malicious_client_ip: {
          inference: {
            model_id: "malicious_clients_model",
            buckets_path: {
              response_count: "responses_total",
              url_dc: "url_dc",
              bytes_sum: "bytes_sum",
              geo_src_dc: "geo_src_dc",
              geo_dest_dc: "geo_dest_dc",
              success: "success._count",
              error404: "error404._count",
              error503: "error503._count",
            },
          },
        },
      },
    },
  },
});
console.log(response);
----
