You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/quickstart/full-text-filtering-tutorial.asciidoc
+16-16Lines changed: 16 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -511,8 +511,9 @@ In this tutorial scenario it's useful for when users have complex requirements f
511
511
512
512
Let's create a query that addresses the following user needs:
513
513
514
-
* Must be a vegetarian main course
514
+
* Must be a vegetarian recipe
515
515
* Should contain "curry" or "spicy" in the title or description
516
+
* Should be a main course
516
517
* Must not be a dessert
517
518
* Must have a rating of at least 4.5
518
519
* Should prefer recipes published in the last month
@@ -524,16 +525,7 @@ GET /cooking_blog/_search
524
525
"query": {
525
526
"bool": {
526
527
"must": [
527
-
{
528
-
"term": {
529
-
"category.keyword": "Main Course"
530
-
}
531
-
},
532
-
{
533
-
"term": {
534
-
"tags": "vegetarian"
535
-
}
536
-
},
528
+
{ "term": { "tags": "vegetarian" } },
537
529
{
538
530
"range": {
539
531
"rating": {
@@ -543,10 +535,18 @@ GET /cooking_blog/_search
543
535
}
544
536
],
545
537
"should": [
538
+
{
539
+
"term": {
540
+
"category": "Main Course"
541
+
}
542
+
},
546
543
{
547
544
"multi_match": {
548
545
"query": "curry spicy",
549
-
"fields": ["title^2", "description"]
546
+
"fields": [
547
+
"title^2",
548
+
"description"
549
+
]
550
550
}
551
551
},
552
552
{
@@ -590,12 +590,12 @@ GET /cooking_blog/_search
590
590
"value": 1,
591
591
"relation": "eq"
592
592
},
593
-
"max_score": 7.9835095,
593
+
"max_score": 7.444513,
594
594
"hits": [
595
595
{
596
596
"_index": "cooking_blog",
597
597
"_id": "2",
598
-
"_score": 7.9835095,
598
+
"_score": 7.444513,
599
599
"_source": {
600
600
"title": "Spicy Thai Green Curry: A Vegetarian Adventure", <1>
601
601
"description": "Dive into the flavors of Thailand with this vibrant green curry. Packed with vegetables and aromatic herbs, this dish is both healthy and satisfying. Don't worry about the heat - you can easily adjust the spice level to your liking.", <2>
@@ -619,8 +619,8 @@ GET /cooking_blog/_search
619
619
<1> The title contains "Spicy" and "Curry", matching our should condition. With the default <<type-best-fields,best_fields>> behavior, this field contributes most to the relevance score.
620
620
<2> While the description also contains matching terms, only the best matching field's score is used by default.
621
621
<3> The recipe was published within the last month, satisfying our recency preference.
622
-
<4> The "Main Course" category matches our `must` condition.
623
-
<5> The "vegetarian" tag satisfies another `must` condition, while "curry" and "spicy" tags align with our `should` preferences.
622
+
<4> The "Main Course" category satisfies another `should` condition.
623
+
<5> The "vegetarian" tag satisfies a `must` condition, while "curry" and "spicy" tags align with our `should` preferences.
624
624
<6> The rating of 4.6 meets our minimum rating requirement of 4.5.
0 commit comments