// 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: "my-index",
  mappings: {
    properties: {
      comments: {
        type: "nested",
      },
    },
  },
});
console.log(response);

const response1 = await client.index({
  index: "my-index",
  id: 1,
  refresh: "true",
  document: {
    comments: [
      {
        author: "kimchy",
      },
    ],
  },
});
console.log(response1);

const response2 = await client.index({
  index: "my-index",
  id: 2,
  refresh: "true",
  document: {
    comments: [
      {
        author: "kimchy",
      },
      {
        author: "nik9000",
      },
    ],
  },
});
console.log(response2);

const response3 = await client.index({
  index: "my-index",
  id: 3,
  refresh: "true",
  document: {
    comments: [
      {
        author: "nik9000",
      },
    ],
  },
});
console.log(response3);

const response4 = await client.search({
  index: "my-index",
  query: {
    nested: {
      path: "comments",
      query: {
        bool: {
          must_not: [
            {
              term: {
                "comments.author": "nik9000",
              },
            },
          ],
        },
      },
    },
  },
});
console.log(response4);
----
