// 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({
  query: {
    bool: {
      filter: [
        {
          term: {
            "event.outcome": "failure",
          },
        },
        {
          range: {
            "@timestamp": {
              gte: "2021-02-01",
              lt: "2021-02-04",
            },
          },
        },
        {
          term: {
            "service.name": {
              value: "frontend-node",
            },
          },
        },
      ],
    },
  },
  aggs: {
    failure_p_value: {
      significant_terms: {
        field: "user_agent.version",
        background_filter: {
          bool: {
            must_not: [
              {
                term: {
                  "event.outcome": "failure",
                },
              },
            ],
            filter: [
              {
                range: {
                  "@timestamp": {
                    gte: "2021-02-01",
                    lt: "2021-02-04",
                  },
                },
              },
              {
                term: {
                  "service.name": {
                    value: "frontend-node",
                  },
                },
              },
            ],
          },
        },
        p_value: {
          background_is_superset: false,
          normalize_above: 1000,
        },
      },
    },
  },
});
console.log(response);
----
