// 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.indices.create({
  index: "my-index-000001",
  mappings: {
    properties: {
      ip: {
        type: "ip",
      },
      version: {
        type: "version",
      },
      missing_keyword: {
        type: "keyword",
      },
      "@timestamp": {
        type: "date",
      },
      type_test: {
        type: "keyword",
      },
      "@timestamp_pretty": {
        type: "date",
        format: "dd-MM-yyyy",
      },
      event_type: {
        type: "keyword",
      },
      event: {
        properties: {
          category: {
            type: "alias",
            path: "event_type",
          },
        },
      },
      host: {
        type: "keyword",
      },
      os: {
        type: "keyword",
      },
      bool: {
        type: "boolean",
      },
      uptime: {
        type: "long",
      },
      port: {
        type: "long",
      },
    },
  },
});
console.log(response);

const response1 = await client.indices.create({
  index: "my-index-000002",
  mappings: {
    properties: {
      ip: {
        type: "ip",
      },
      "@timestamp": {
        type: "date",
      },
      "@timestamp_pretty": {
        type: "date",
        format: "yyyy-MM-dd",
      },
      type_test: {
        type: "keyword",
      },
      event_type: {
        type: "keyword",
      },
      event: {
        properties: {
          category: {
            type: "alias",
            path: "event_type",
          },
        },
      },
      host: {
        type: "keyword",
      },
      op_sys: {
        type: "keyword",
      },
      bool: {
        type: "boolean",
      },
      uptime: {
        type: "long",
      },
      port: {
        type: "long",
      },
    },
  },
});
console.log(response1);

const response2 = await client.indices.create({
  index: "my-index-000003",
  mappings: {
    properties: {
      host_ip: {
        type: "ip",
      },
      "@timestamp": {
        type: "date",
      },
      date: {
        type: "date",
      },
      event_type: {
        type: "keyword",
      },
      event: {
        properties: {
          category: {
            type: "alias",
            path: "event_type",
          },
        },
      },
      missing_keyword: {
        type: "keyword",
      },
      host: {
        type: "keyword",
      },
      os: {
        type: "keyword",
      },
      bool: {
        type: "boolean",
      },
      uptime: {
        type: "long",
      },
      port: {
        type: "long",
      },
    },
  },
});
console.log(response2);

const response3 = await client.bulk({
  index: "my-index-000001",
  refresh: "true",
  operations: [
    {
      index: {
        _id: 1,
      },
    },
    {
      "@timestamp": "1234567891",
      "@timestamp_pretty": "12-12-2022",
      missing_keyword: "test",
      type_test: "abc",
      ip: "10.0.0.1",
      event_type: "alert",
      host: "doom",
      uptime: 0,
      port: 1234,
      os: "win10",
      version: "1.0.0",
      id: 11,
    },
    {
      index: {
        _id: 2,
      },
    },
    {
      "@timestamp": "1234567892",
      "@timestamp_pretty": "13-12-2022",
      event_type: "alert",
      type_test: "abc",
      host: "CS",
      uptime: 5,
      port: 1,
      os: "win10",
      version: "1.2.0",
      id: 12,
    },
    {
      index: {
        _id: 3,
      },
    },
    {
      "@timestamp": "1234567893",
      "@timestamp_pretty": "12-12-2022",
      event_type: "alert",
      type_test: "abc",
      host: "farcry",
      uptime: 1,
      port: 1234,
      bool: false,
      os: "win10",
      version: "2.0.0",
      id: 13,
    },
    {
      index: {
        _id: 4,
      },
    },
    {
      "@timestamp": "1234567894",
      "@timestamp_pretty": "13-12-2022",
      event_type: "alert",
      type_test: "abc",
      host: "GTA",
      uptime: 3,
      port: 12,
      os: "slack",
      version: "10.0.0",
      id: 14,
    },
    {
      index: {
        _id: 5,
      },
    },
    {
      "@timestamp": "1234567895",
      "@timestamp_pretty": "17-12-2022",
      event_type: "alert",
      host: "sniper 3d",
      uptime: 6,
      port: 1234,
      os: "fedora",
      version: "20.1.0",
      id: 15,
    },
    {
      index: {
        _id: 6,
      },
    },
    {
      "@timestamp": "1234568896",
      "@timestamp_pretty": "17-12-2022",
      event_type: "alert",
      host: "doom",
      port: 65123,
      bool: true,
      os: "redhat",
      version: "20.10.0",
      id: 16,
    },
    {
      index: {
        _id: 7,
      },
    },
    {
      "@timestamp": "1234567897",
      "@timestamp_pretty": "17-12-2022",
      missing_keyword: "yyy",
      event_type: "failure",
      host: "doom",
      uptime: 15,
      port: 1234,
      bool: true,
      os: "redhat",
      version: "20.2.0",
      id: 17,
    },
    {
      index: {
        _id: 8,
      },
    },
    {
      "@timestamp": "1234567898",
      "@timestamp_pretty": "12-12-2022",
      missing_keyword: "test",
      event_type: "success",
      host: "doom",
      uptime: 16,
      port: 512,
      os: "win10",
      version: "1.2.3",
      id: 18,
    },
    {
      index: {
        _id: 9,
      },
    },
    {
      "@timestamp": "1234567899",
      "@timestamp_pretty": "15-12-2022",
      missing_keyword: "test",
      event_type: "success",
      host: "GTA",
      port: 12,
      bool: true,
      os: "win10",
      version: "1.2.3",
      id: 19,
    },
    {
      index: {
        _id: 10,
      },
    },
    {
      "@timestamp": "1234567893",
      missing_keyword: null,
      ip: "10.0.0.5",
      event_type: "alert",
      host: "farcry",
      uptime: 1,
      port: 1234,
      bool: true,
      os: "win10",
      version: "1.2.3",
      id: 110,
    },
  ],
});
console.log(response3);

const response4 = await client.bulk({
  index: "my-index-000002",
  refresh: "true",
  operations: [
    {
      index: {
        _id: 1,
      },
    },
    {
      "@timestamp": "1234567991",
      type_test: "abc",
      ip: "10.0.0.1",
      event_type: "alert",
      host: "doom",
      uptime: 0,
      port: 1234,
      op_sys: "win10",
      id: 21,
    },
    {
      index: {
        _id: 2,
      },
    },
    {
      "@timestamp": "1234567992",
      type_test: "abc",
      event_type: "alert",
      host: "CS",
      uptime: 5,
      port: 1,
      op_sys: "win10",
      id: 22,
    },
    {
      index: {
        _id: 3,
      },
    },
    {
      "@timestamp": "1234567993",
      type_test: "abc",
      "@timestamp_pretty": "2022-12-17",
      event_type: "alert",
      host: "farcry",
      uptime: 1,
      port: 1234,
      bool: false,
      op_sys: "win10",
      id: 23,
    },
    {
      index: {
        _id: 4,
      },
    },
    {
      "@timestamp": "1234567994",
      event_type: "alert",
      host: "GTA",
      uptime: 3,
      port: 12,
      op_sys: "slack",
      id: 24,
    },
    {
      index: {
        _id: 5,
      },
    },
    {
      "@timestamp": "1234567995",
      event_type: "alert",
      host: "sniper 3d",
      uptime: 6,
      port: 1234,
      op_sys: "fedora",
      id: 25,
    },
    {
      index: {
        _id: 6,
      },
    },
    {
      "@timestamp": "1234568996",
      "@timestamp_pretty": "2022-12-17",
      ip: "10.0.0.5",
      event_type: "alert",
      host: "doom",
      port: 65123,
      bool: true,
      op_sys: "redhat",
      id: 26,
    },
    {
      index: {
        _id: 7,
      },
    },
    {
      "@timestamp": "1234567997",
      "@timestamp_pretty": "2022-12-17",
      event_type: "failure",
      host: "doom",
      uptime: 15,
      port: 1234,
      bool: true,
      op_sys: "redhat",
      id: 27,
    },
    {
      index: {
        _id: 8,
      },
    },
    {
      "@timestamp": "1234567998",
      ip: "10.0.0.1",
      event_type: "success",
      host: "doom",
      uptime: 16,
      port: 512,
      op_sys: "win10",
      id: 28,
    },
    {
      index: {
        _id: 9,
      },
    },
    {
      "@timestamp": "1234567999",
      ip: "10.0.0.1",
      event_type: "success",
      host: "GTA",
      port: 12,
      bool: false,
      op_sys: "win10",
      id: 29,
    },
  ],
});
console.log(response4);

const response5 = await client.bulk({
  index: "my-index-000003",
  refresh: "true",
  operations: [
    {
      index: {
        _id: 1,
      },
    },
    {
      "@timestamp": "1334567891",
      host_ip: "10.0.0.1",
      event_type: "alert",
      host: "doom",
      uptime: 0,
      port: 12,
      os: "win10",
      id: 31,
    },
    {
      index: {
        _id: 2,
      },
    },
    {
      "@timestamp": "1334567892",
      event_type: "alert",
      host: "CS",
      os: "win10",
      id: 32,
    },
    {
      index: {
        _id: 3,
      },
    },
    {
      "@timestamp": "1334567893",
      event_type: "alert",
      host: "farcry",
      bool: true,
      os: "win10",
      id: 33,
    },
    {
      index: {
        _id: 4,
      },
    },
    {
      "@timestamp": "1334567894",
      event_type: "alert",
      host: "GTA",
      os: "slack",
      bool: true,
      id: 34,
    },
    {
      index: {
        _id: 5,
      },
    },
    {
      "@timestamp": "1234567895",
      event_type: "alert",
      host: "sniper 3d",
      os: "fedora",
      id: 35,
    },
    {
      index: {
        _id: 6,
      },
    },
    {
      "@timestamp": "1234578896",
      host_ip: "10.0.0.1",
      event_type: "alert",
      host: "doom",
      bool: true,
      os: "redhat",
      id: 36,
    },
    {
      index: {
        _id: 7,
      },
    },
    {
      "@timestamp": "1234567897",
      event_type: "failure",
      missing_keyword: "test",
      host: "doom",
      bool: true,
      os: "redhat",
      id: 37,
    },
    {
      index: {
        _id: 8,
      },
    },
    {
      "@timestamp": "1234577898",
      event_type: "success",
      host: "doom",
      os: "win10",
      id: 38,
      date: "1671235200000",
    },
    {
      index: {
        _id: 9,
      },
    },
    {
      "@timestamp": "1234577899",
      host_ip: "10.0.0.5",
      event_type: "success",
      host: "GTA",
      bool: true,
      os: "win10",
      id: 39,
    },
  ],
});
console.log(response5);
----
