// 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-rank-vectors-bit",
  mappings: {
    properties: {
      my_vector: {
        type: "rank_vectors",
        element_type: "bit",
      },
    },
  },
});
console.log(response);

const response1 = await client.bulk({
  index: "my-rank-vectors-bit",
  refresh: "true",
  operations: [
    {
      index: {
        _id: "1",
      },
    },
    {
      my_vector: [127, -127, 0, 1, 42],
    },
    {
      index: {
        _id: "2",
      },
    },
    {
      my_vector: "8100012a7f",
    },
  ],
});
console.log(response1);

const response2 = await client.search({
  index: "my-rank-vectors-bit",
  query: {
    script_score: {
      query: {
        match_all: {},
      },
      script: {
        source: "maxSimDotProduct(params.query_vector, 'my_vector')",
        params: {
          query_vector: [
            [
              0.35, 0.77, 0.95, 0.15, 0.11, 0.08, 0.58, 0.06, 0.44, 0.52, 0.21,
              0.62, 0.65, 0.16, 0.64, 0.39, 0.93, 0.06, 0.93, 0.31, 0.92, 0,
              0.66, 0.86, 0.92, 0.03, 0.81, 0.31, 0.2, 0.92, 0.95, 0.64, 0.19,
              0.26, 0.77, 0.64, 0.78, 0.32, 0.97, 0.84,
            ],
          ],
        },
      },
    },
  },
});
console.log(response2);
----
