// 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.indices.create({
  index: "test-index",
  mappings: {
    properties: {
      source_field: {
        type: "text",
        fields: {
          infer_field: {
            type: "semantic_text",
            inference_id: ".elser-2-elasticsearch",
          },
        },
      },
    },
  },
});
console.log(response);
----
