ES 筆記七:Search API 概覽

CrazyZard發表於2019-10-16
  • URL Search
    • 在URL中使用查詢引數
  • Request Body Search
    • 使用Elasticsearch 提供的,基於JSON格式的格式更加完備的 Query Dpmain Specific Language (DSL)
語法 範圍
/_search 叢集上所有的索引
/index1/_search index1
/index1,index2/_search index1和index2
/index*/_search 以index開頭的索引
  • 使用 "q" ,指定查詢字串
  • "query string syntax" , KV鍵值對

ES 筆記七:Search Api 概覽

ES 筆記七:Search Api 概覽

ES 筆記七:Search Api 概覽

  • 搜尋是使用者和搜尋引擎的對話
  • 使用者關心的是搜尋結果的相關性
    • 是否找到所有相關的內容
    • 有多少不相關的內容被返回了
    • 文件的打分是否合理
    • 結合業務需求,平衡結果排名

ES 筆記七:Search Api 概覽

WEB 搜尋

  • Page Rank 演算法
    • 不僅僅是內容
    • 更重要的是內容的可信度

電商搜尋

  • 搜尋引擎扮演 - 銷售的角色
    • 提高使用者購物體驗
    • 提升網站的銷售業績
    • 去庫存

衡量相關性

  • Information Retrieval
    • Precision (查準率) - 儘可能返回較少的無關文件
    • Recall (查全率) - 儘量返回較多的相關文件
    • Ranking - 是否能夠按照相關度進行排序

Precision & Recall

  • Prcision - True Positive / 全部返回的結果 (True and False Positives)
  • Recall - True Positive / 返回應該返回的結果 (True positives + false Negtives)
  • 使用Elasticsearch 的查詢和相關引數改善搜尋的Precision 和 Recall
    ES 筆記七:Search Api 概覽

相關文章