Skip to content

Commit ab604ad

Browse files
authored
[DOCS] Update tutorial example (elastic#117538)
1 parent 54db947 commit ab604ad

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

docs/reference/quickstart/full-text-filtering-tutorial.asciidoc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,9 @@ In this tutorial scenario it's useful for when users have complex requirements f
511511

512512
Let's create a query that addresses the following user needs:
513513

514-
* Must be a vegetarian main course
514+
* Must be a vegetarian recipe
515515
* Should contain "curry" or "spicy" in the title or description
516+
* Should be a main course
516517
* Must not be a dessert
517518
* Must have a rating of at least 4.5
518519
* Should prefer recipes published in the last month
@@ -524,16 +525,7 @@ GET /cooking_blog/_search
524525
"query": {
525526
"bool": {
526527
"must": [
527-
{
528-
"term": {
529-
"category.keyword": "Main Course"
530-
}
531-
},
532-
{
533-
"term": {
534-
"tags": "vegetarian"
535-
}
536-
},
528+
{ "term": { "tags": "vegetarian" } },
537529
{
538530
"range": {
539531
"rating": {
@@ -543,10 +535,18 @@ GET /cooking_blog/_search
543535
}
544536
],
545537
"should": [
538+
{
539+
"term": {
540+
"category": "Main Course"
541+
}
542+
},
546543
{
547544
"multi_match": {
548545
"query": "curry spicy",
549-
"fields": ["title^2", "description"]
546+
"fields": [
547+
"title^2",
548+
"description"
549+
]
550550
}
551551
},
552552
{
@@ -590,12 +590,12 @@ GET /cooking_blog/_search
590590
"value": 1,
591591
"relation": "eq"
592592
},
593-
"max_score": 7.9835095,
593+
"max_score": 7.444513,
594594
"hits": [
595595
{
596596
"_index": "cooking_blog",
597597
"_id": "2",
598-
"_score": 7.9835095,
598+
"_score": 7.444513,
599599
"_source": {
600600
"title": "Spicy Thai Green Curry: A Vegetarian Adventure", <1>
601601
"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
619619
<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.
620620
<2> While the description also contains matching terms, only the best matching field's score is used by default.
621621
<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.
624624
<6> The rating of 4.6 meets our minimum rating requirement of 4.5.
625625
==============
626626

0 commit comments

Comments
 (0)