// 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.search({
  index: "quantized-image-index",
  knn: {
    field: "image-vector",
    query_vector: [0.1, -2],
    k: 15,
    num_candidates: 100,
  },
  fields: ["title"],
  rescore: {
    window_size: 10,
    query: {
      rescore_query: {
        script_score: {
          query: {
            match_all: {},
          },
          script: {
            source:
              "cosineSimilarity(params.query_vector, 'image-vector') + 1.0",
            params: {
              query_vector: [0.1, -2],
            },
          },
        },
      },
    },
  },
});
console.log(response);
----
