白話Elasticsearch11-深度探秘搜索技術之基于tie_breaker參數優化dis_max搜索效果

      網友投稿 805 2025-04-04

      文章目錄

      概述

      官方文檔

      例子

      tie_breaker

      概述

      繼續跟中華石杉老師學習ES,第十一

      課程地址: https://www.roncoo.com/view/55

      官方文檔

      https://www.elastic.co/guide/en/elasticsearch/guide/current/_tuning_best_fields_queries.html

      https://www.elastic.co/guide/en/elasticsearch/reference/7.2/query-dsl-dis-max-query.html

      例子

      數據同 上篇博文 構造索引的DSL

      這次我們使用dis_max查詢 java beginner , DSL如下

      GET /forum/article/_search { "query": { "dis_max": { "queries": [ { "match": { "title": "java beginner" } }, { "match": { "content": "java beginner" } } ] } } }

      1

      2

      3

      4

      5

      6

      7

      8

      9

      10

      11

      12

      13

      14

      15

      16

      17

      18

      19

      返回

      { "took": 2, "timed_out": false, "_shards": { "total": 1, "successful": 1, "skipped": 0, "failed": 0 }, "hits": { "total": 5, "max_score": 1.0341108, "hits": [ { "_index": "forum", "_type": "article", "_id": "3", "_score": 1.0341108, "_source": { "articleID": "JODL-X-1937-#pV7", "userID": 2, "hidden": false, "postDate": "2017-01-01", "tag": [ "hadoop" ], "tag_cnt": 1, "view_cnt": 100, "title": "this is elasticsearch blog", "content": "i am only an elasticsearch beginner" } }, { "_index": "forum", "_type": "article", "_id": "2", "_score": 0.93952733, "_source": { "articleID": "KDKE-B-9947-#kL5", "userID": 1, "hidden": false, "postDate": "2017-01-02", "tag": [ "java" ], "tag_cnt": 1, "view_cnt": 50, "title": "this is java blog", "content": "i think java is the best programming language" } }, { "_index": "forum", "_type": "article", "_id": "4", "_score": 0.79423964, "_source": { "articleID": "QQPX-R-3956-#aD8", "userID": 2, "hidden": true, "postDate": "2017-01-02", "tag": [ "java", "elasticsearch" ], "tag_cnt": 2, "view_cnt": 80, "title": "this is java, elasticsearch, hadoop blog", "content": "elasticsearch and hadoop are all very good solution, i am a beginner" } }, { "_index": "forum", "_type": "article", "_id": "5", "_score": 0.7116974, "_source": { "articleID": "DHJK-B-1395-#Ky5", "userID": 3, "hidden": false, "postDate": "2019-05-01", "tag": [ "elasticsearch" ], "tag_cnt": 1, "view_cnt": 10, "title": "this is spark blog", "content": "spark is best big data solution based on scala ,an programming language similar to java" } }, { "_index": "forum", "_type": "article", "_id": "1", "_score": 0.4889865, "_source": { "articleID": "XHDK-A-1293-#fJ3", "userID": 1, "hidden": false, "postDate": "2017-01-01", "tag": [ "java", "hadoop" ], "tag_cnt": 2, "view_cnt": 30, "title": "this is java and elasticsearch blog", "content": "i like to write best elasticsearch article" } } ] } }

      1

      2

      3

      4

      5

      6

      7

      8

      9

      10

      11

      12

      13

      14

      15

      16

      17

      18

      19

      20

      21

      22

      23

      24

      25

      26

      27

      28

      29

      30

      31

      32

      33

      34

      35

      36

      37

      38

      39

      40

      41

      42

      43

      44

      45

      46

      47

      48

      49

      50

      51

      52

      53

      54

      55

      56

      57

      58

      59

      60

      61

      62

      63

      64

      65

      66

      67

      68

      69

      70

      71

      72

      73

      74

      75

      76

      77

      78

      79

      80

      81

      82

      83

      84

      85

      86

      87

      88

      89

      90

      91

      92

      93

      94

      95

      96

      97

      98

      99

      100

      101

      102

      103

      104

      105

      106

      107

      108

      109

      110

      111

      112

      113

      不知道為啥id=3的相關度是最高的… 如果有知道的,煩請不吝賜教。

      dis_max只取某一個query最大的分數,完全不考慮其他query的分數

      tie_breaker

      使用tie_breaker將其他query的分數也考慮進去

      tie_breaker參數的意義,在于說,將其他query的分數,乘以tie_breaker,然后綜合與最高分數的那個query的分數,綜合在一起進行計算,除了取最高分以外,還會考慮其他的query的分數。

      tie_breaker的值,在0~1之間,是個小數。

      GET /forum/article/_search { "query": { "dis_max": { "queries": [ { "match": { "title": "java beginner" } }, { "match": { "content": "java beginner" } } ], "tie_breaker": 0.7 } } }

      1

      2

      3

      4

      5

      6

      7

      8

      9

      10

      11

      12

      13

      14

      15

      16

      17

      18

      19

      20

      21

      返回結果

      { "took": 2, "timed_out": false, "_shards": { "total": 1, "successful": 1, "skipped": 0, "failed": 0 }, "hits": { "total": 5, "max_score": 1.344432, "hits": [ { "_index": "forum", "_type": "article", "_id": "2", "_score": 1.344432, "_source": { "articleID": "KDKE-B-9947-#kL5", "userID": 1, "hidden": false, "postDate": "2017-01-02", "tag": [ "java" ], "tag_cnt": 1, "view_cnt": 50, "title": "this is java blog", "content": "i think java is the best programming language" } }, { "_index": "forum", "_type": "article", "_id": "4", "_score": 1.1365302, "_source": { "articleID": "QQPX-R-3956-#aD8", "userID": 2, "hidden": true, "postDate": "2017-01-02", "tag": [ "java", "elasticsearch" ], "tag_cnt": 2, "view_cnt": 80, "title": "this is java, elasticsearch, hadoop blog", "content": "elasticsearch and hadoop are all very good solution, i am a beginner" } }, { "_index": "forum", "_type": "article", "_id": "3", "_score": 1.0341108, "_source": { "articleID": "JODL-X-1937-#pV7", "userID": 2, "hidden": false, "postDate": "2017-01-01", "tag": [ "hadoop" ], "tag_cnt": 1, "view_cnt": 100, "title": "this is elasticsearch blog", "content": "i am only an elasticsearch beginner" } }, { "_index": "forum", "_type": "article", "_id": "5", "_score": 0.7116974, "_source": { "articleID": "DHJK-B-1395-#Ky5", "userID": 3, "hidden": false, "postDate": "2019-05-01", "tag": [ "elasticsearch" ], "tag_cnt": 1, "view_cnt": 10, "title": "this is spark blog", "content": "spark is best big data solution based on scala ,an programming language similar to java" } }, { "_index": "forum", "_type": "article", "_id": "1", "_score": 0.4889865, "_source": { "articleID": "XHDK-A-1293-#fJ3", "userID": 1, "hidden": false, "postDate": "2017-01-01", "tag": [ "java", "hadoop" ], "tag_cnt": 2, "view_cnt": 30, "title": "this is java and elasticsearch blog", "content": "i like to write best elasticsearch article" } } ] } }

      1

      2

      3

      4

      5

      6

      7

      8

      9

      10

      11

      12

      13

      14

      15

      16

      17

      18

      19

      20

      21

      22

      23

      24

      25

      26

      27

      28

      29

      30

      31

      32

      33

      34

      35

      36

      37

      38

      39

      40

      41

      42

      43

      44

      45

      46

      47

      48

      49

      50

      51

      52

      53

      54

      55

      56

      57

      58

      59

      60

      61

      62

      63

      64

      65

      66

      67

      68

      69

      70

      白話Elasticsearch11-深度探秘搜索技術之基于tie_breaker參數優化dis_max搜索效果

      71

      72

      73

      74

      75

      76

      77

      78

      79

      80

      81

      82

      83

      84

      85

      86

      87

      88

      89

      90

      91

      92

      93

      94

      95

      96

      97

      98

      99

      100

      101

      102

      103

      104

      105

      106

      107

      108

      109

      110

      111

      112

      113

      Elasticsearch 數據接入服務 DIS

      版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。

      版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。

      上一篇:2013excel表格如何去掉網格線
      下一篇:WPS表格技巧—表格中如何帶單位求和(wps表格帶單位的數字怎么求和)
      相關文章
      国产gv天堂亚洲国产gv刚刚碰 | 亚洲AV日韩AV天堂一区二区三区| 久久精品国产亚洲av麻豆图片| 亚洲欧洲国产综合AV无码久久| 狠狠色婷婷狠狠狠亚洲综合| 亚洲高清在线播放| 亚洲国产精品综合久久网络| 久久久久亚洲av无码专区 | 亚洲一区中文字幕在线电影网 | 日韩亚洲精品福利| 亚洲人成在线播放| 亚洲av无码专区国产乱码在线观看 | 在线亚洲v日韩v| 亚洲精品午夜无码电影网| 蜜臀亚洲AV无码精品国产午夜.| 亚洲日韩精品国产一区二区三区| 日本亚洲色大成网站www久久| 亚洲人成网站在线观看播放动漫 | 最新精品亚洲成a人在线观看| 亚洲国产高清在线一区二区三区| www国产亚洲精品久久久日本| 亚洲福利在线播放| 亚洲五月综合缴情在线观看| 亚洲黄片毛片在线观看| 亚洲伊人成无码综合网 | 亚洲jjzzjjzz在线播放| 亚洲综合偷自成人网第页色| 亚洲人成小说网站色| 日韩亚洲产在线观看| 中文字幕亚洲专区| 国产精品亚洲精品日韩动图| 亚洲视频人成在线播放| 亚洲人成无码网站| 亚洲国产成人久久精品99 | 亚洲成综合人影院在院播放| 国产精品亚洲午夜一区二区三区| 色噜噜亚洲男人的天堂| 亚洲一区在线观看视频| 在线亚洲午夜片AV大片| 国产亚洲综合视频| 亚洲国产另类久久久精品黑人|