// 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({
  index: "my-index-000001",
  size: 0,
  runtime_mappings: {
    message_and_context: {
      type: "keyword",
      script:
        "\n        emit(doc['message.keyword'].value + ' ' + doc['context.keyword'].value)\n      ",
    },
  },
  aggs: {
    message_stats: {
      string_stats: {
        field: "message_and_context",
      },
    },
  },
});
console.log(response);
----
