62 lines
1.4 KiB
Plaintext
62 lines
1.4 KiB
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: "retrievers_example",
|
|
retriever: {
|
|
linear: {
|
|
retrievers: [
|
|
{
|
|
retriever: {
|
|
standard: {
|
|
query: {
|
|
function_score: {
|
|
query: {
|
|
term: {
|
|
topic: "ai",
|
|
},
|
|
},
|
|
functions: [
|
|
{
|
|
script_score: {
|
|
script: {
|
|
source: "doc['timestamp'].value.millis",
|
|
},
|
|
},
|
|
},
|
|
],
|
|
boost_mode: "replace",
|
|
},
|
|
},
|
|
sort: {
|
|
timestamp: {
|
|
order: "asc",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
weight: 2,
|
|
normalizer: "minmax",
|
|
},
|
|
{
|
|
retriever: {
|
|
knn: {
|
|
field: "vector",
|
|
query_vector: [0.23, 0.67, 0.89],
|
|
k: 3,
|
|
num_candidates: 5,
|
|
},
|
|
},
|
|
weight: 1.5,
|
|
},
|
|
],
|
|
rank_window_size: 10,
|
|
},
|
|
},
|
|
_source: false,
|
|
});
|
|
console.log(response);
|
|
----
|