// 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({
  runtime_mappings: {
    day_of_week: {
      type: "keyword",
      script:
        "\n        emit(doc['timestamp'].value.dayOfWeekEnum\n          .getDisplayName(TextStyle.FULL, Locale.ENGLISH))\n      ",
    },
  },
  size: 0,
  aggs: {
    my_buckets: {
      composite: {
        sources: [
          {
            dow: {
              terms: {
                field: "day_of_week",
              },
            },
          },
        ],
      },
    },
  },
});
console.log(response);
----
