// 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",
  mappings: {
    properties: {
      my_join_field: {
        type: "join",
        relations: {
          my_parent: "my_child",
        },
      },
    },
  },
});
console.log(response);

const response1 = await client.index({
  index: "test",
  id: 1,
  refresh: "true",
  document: {
    number: 1,
    my_join_field: "my_parent",
  },
});
console.log(response1);

const response2 = await client.index({
  index: "test",
  id: 2,
  routing: 1,
  refresh: "true",
  document: {
    number: 1,
    my_join_field: {
      name: "my_child",
      parent: "1",
    },
  },
});
console.log(response2);

const response3 = await client.search({
  index: "test",
  query: {
    has_child: {
      type: "my_child",
      query: {
        match: {
          number: 1,
        },
      },
      inner_hits: {},
    },
  },
});
console.log(response3);
----
