[source, ruby]
----
response = client.search(
  index: 'my-index-000001',
  body: {
    runtime_mappings: {
      day_of_week: {
        type: 'keyword',
        script: {
          source: "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))"
        }
      }
    },
    aggregations: {
      day_of_week: {
        terms: {
          field: 'day_of_week'
        }
      }
    }
  }
)
puts response
----
