32 lines
653 B
Plaintext
32 lines
653 B
Plaintext
// 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.search({
|
|
index: "product-index",
|
|
query: {
|
|
script_score: {
|
|
query: {
|
|
bool: {
|
|
filter: {
|
|
range: {
|
|
price: {
|
|
gte: 1000,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
script: {
|
|
source: "cosineSimilarity(params.queryVector, 'product-vector') + 1.0",
|
|
params: {
|
|
queryVector: [-0.5, 90, -10, 14.8, -156],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
----
|