56 lines
998 B
Plaintext
56 lines
998 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: "cooking_blog",
|
|
query: {
|
|
bool: {
|
|
must: [
|
|
{
|
|
term: {
|
|
"category.keyword": "Main Course",
|
|
},
|
|
},
|
|
{
|
|
term: {
|
|
tags: "vegetarian",
|
|
},
|
|
},
|
|
{
|
|
range: {
|
|
rating: {
|
|
gte: 4.5,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
should: [
|
|
{
|
|
multi_match: {
|
|
query: "curry spicy",
|
|
fields: ["title^2", "description"],
|
|
},
|
|
},
|
|
{
|
|
range: {
|
|
date: {
|
|
gte: "now-1M/d",
|
|
},
|
|
},
|
|
},
|
|
],
|
|
must_not: [
|
|
{
|
|
term: {
|
|
"category.keyword": "Dessert",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
----
|