58 lines
1.2 KiB
Plaintext
58 lines
1.2 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.transport.request({
|
|
method: "PUT",
|
|
path: "/_query_rules/my-ruleset",
|
|
body: {
|
|
rules: [
|
|
{
|
|
rule_id: "rule1",
|
|
type: "pinned",
|
|
criteria: [
|
|
{
|
|
type: "fuzzy",
|
|
metadata: "query_string",
|
|
values: ["puggles", "pugs"],
|
|
},
|
|
{
|
|
type: "exact",
|
|
metadata: "user_country",
|
|
values: ["us"],
|
|
},
|
|
],
|
|
actions: {
|
|
ids: ["id1", "id2"],
|
|
},
|
|
},
|
|
{
|
|
rule_id: "rule2",
|
|
type: "exclude",
|
|
criteria: [
|
|
{
|
|
type: "contains",
|
|
metadata: "query_string",
|
|
values: ["beagles"],
|
|
},
|
|
],
|
|
actions: {
|
|
docs: [
|
|
{
|
|
_index: "my-index-000001",
|
|
_id: "id3",
|
|
},
|
|
{
|
|
_index: "my-index-000002",
|
|
_id: "id4",
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
console.log(response);
|
|
----
|