Hello,
My document has a title field and an intro field. I have given greater importance to the title field over the intro field in my query, yet all other fields being equal, the intro field is getting a higher score than the title field. Can anyone point out where I'm going wrong?
Query:
"body" => array:4 [
"query" => array:1 [
"function_score" => array:2 [
"query" => array:1 [
"bool" => array:4 [
"must" => []
"should" => array:15 [
0 => array:1 [
"match" => array:1 [
"title" => array:4 [
"query" => "test"
"boost" => 1
"fuzziness" => "AUTO"
"operator" => "OR"
]
]
]
1 => array:1 [
"match" => array:1 [
"title" => array:4 [
"query" => "test"
"boost" => 2
"fuzziness" => "AUTO"
"operator" => "and"
]
]
]
2 => array:1 [
"match_phrase" => array:1 [
"title" => array:2 [
"query" => "test"
"boost" => 3
]
]
]
3 => array:1 [
"match" => array:1 [
"organisation_name" => array:4 [
"query" => "test"
"boost" => 1
"fuzziness" => "AUTO"
"operator" => "OR"
]
]
]
4 => array:1 [
"match" => array:1 [
"organisation_name" => array:4 [
"query" => "test"
"boost" => 2
"fuzziness" => "AUTO"
"operator" => "and"
]
]
]
5 => array:1 [
"match_phrase" => array:1 [
"organisation_name" => array:2 [
"query" => "test"
"boost" => 3
]
]
]
6 => array:1 [
"match" => array:1 [
"intro" => array:4 [
"query" => "test"
"boost" => 1
"fuzziness" => "AUTO"
"operator" => "OR"
]
]
]
7 => array:1 [
"match" => array:1 [
"intro" => array:4 [
"query" => "test"
"boost" => 1.5
"fuzziness" => "AUTO"
"operator" => "and"
]
]
]
8 => array:1 [
"match_phrase" => array:1 [
"intro" => array:2 [
"query" => "test"
"boost" => 2.5
]
]
]
9 => array:1 [
"match" => array:1 [
"description" => array:4 [
"query" => "test"
"boost" => 0.5
"fuzziness" => "AUTO"
"operator" => "OR"
]
]
]
10 => array:1 [
"match" => array:1 [
"description" => array:4 [
"query" => "test"
"boost" => 1.5
"fuzziness" => "AUTO"
"operator" => "and"
]
]
]
11 => array:1 [
"match_phrase" => array:1 [
"description" => array:2 [
"query" => "test"
"boost" => 2
]
]
]
12 => array:1 [
"match" => array:1 [
"taxonomy_categories" => array:4 [
"query" => "test"
"boost" => 0.5
"fuzziness" => "AUTO"
"operator" => "OR"
]
]
]
13 => array:1 [
"match" => array:1 [
"taxonomy_categories" => array:4 [
"query" => "test"
"boost" => 1
"fuzziness" => "AUTO"
"operator" => "and"
]
]
]
14 => array:1 [
"match_phrase" => array:1 [
"taxonomy_categories" => array:2 [
"query" => "test"
"boost" => 1.5
]
]
]
]
"filter" => array:1 [
0 => array:1 [
"range" => array:1 [
"end_date" => array:1 [
"gte" => "now/d"
]
]
]
]
"minimum_should_match" => 1
]
]
"functions" => []
]
]
"sort" => array:1 [
0 => "_score"
]
"from" => 0
"size" => 20
]
Hits:
-hit: array:5 [
"_index" => "testing_events"
"_type" => "_doc"
"_id" => "e7c8164a-7b77-498b-98ce-031d32ea7bcb"
"_score" => 5.0830793
"_source" => array:12 [
"id" => "e7c8164a-7b77-498b-98ce-031d32ea7bcb"
"title" => "Organisation Event Title"
"intro" => "This is a test"
"description" => "Nulla consequat massa quis enim Donec pede justo fringilla vel aliquet nec vulputate eget arcu In enim justo rhoncus ut imperdiet a venenatis vitae justo Nullam dictum felis eu pede mollis pretium "
"start_date" => "2023-10-08T20:17:21"
"end_date" => "2023-10-08T09:37:54"
"is_free" => true
"is_virtual" => true
"organisation_name" => "Baker Ltd fuga 80510"
"taxonomy_categories" => []
"collection_categories" => []
"event_location" => null
]
]
-hit: array:5 [
"_index" => "testing_events"
"_type" => "_doc"
"_id" => "7e01f0a3-02c4-48cd-980b-23c15f2935f1"
"_score" => 4.8155494
"_source" => array:12 [
"id" => "7e01f0a3-02c4-48cd-980b-23c15f2935f1"
"title" => "This is a test"
"intro" => "Lorem ipsum dolor sit amet consectetuer adipiscing elit"
"description" => "Nulla consequat massa quis enim Donec pede justo fringilla vel aliquet nec vulputate eget arcu In enim justo rhoncus ut imperdiet a venenatis vitae justo Nullam dictum felis eu pede mollis pretium "
"start_date" => "2023-10-15T10:35:40"
"end_date" => "2023-10-15T20:08:36"
"is_free" => true
"is_virtual" => true
"organisation_name" => "Fox Ltd amet 57268"
"taxonomy_categories" => []
"collection_categories" => []
"event_location" => null
]
]
Thanks