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