import{s as nl,n as il,o as pl}from"../chunks/scheduler.65852ee5.js";import{S as ol,i as cl,g as i,s as a,r as c,A as Ml,h as p,f as l,c as n,j as el,u as M,x as o,k as al,y as rl,a as e,v as r,d as h,t as m,w as j}from"../chunks/index.aa74147d.js";import{D as hl,C as J}from"../chunks/DocNotebookDropdown.1a7e6a42.js";import{H as y,E as ml}from"../chunks/getInferenceSnippets.a1cbc7e2.js";function jl(ft){let T,gs,ws,ds,u,Is,w,Cs,U,bt='<em>作者：<a href="https://github.com/leemthompo" rel="nofollow">Liam Thompson</a></em>',fs,g,$t="在本 Notebook 中，我们将学习如何通过将 Hugging Face 中的模型上传到 Elasticsearch 集群来实现语义重排序。我们将使用 <code>retriever</code> 抽象，它是一个简化的 Elasticsearch 查询语法，便于构建查询并结合不同的搜索操作。",bs,d,At="你将会：",$s,I,vt='<li>从 Hugging Face 选择一个跨编码器模型来执行语义重排序</li> <li>使用 <a href="https://www.elastic.co/guide/en/elasticsearch/client/eland/current/machine-learning.html" rel="nofollow">Eland</a> —— 一个用于与 Elasticsearch 进行机器学习的 Python 客户端，将模型上传到你的 Elasticsearch 部署</li> <li>创建一个推理端点来管理你的 <code>rerank</code> 任务</li> <li>使用 <code>text_similarity_rerank</code> 检索器查询你的数据</li>',As,C,vs,f,qt="为了运行此示例，你需要：",qs,b,Et='<li><p>一个版本为 8.15.0 或更高版本的 Elastic 部署（对于非无服务器部署）</p> <ul><li>我们将在本示例中使用 Elastic Cloud（可通过 <a href="https://cloud.elastic.co/registration" rel="nofollow">免费试用</a> 进行访问）。</li> <li>查看其他 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/elasticsearch-intro.html#elasticsearch-intro-deploy" rel="nofollow">部署选项</a></li></ul></li> <li><p>你需要找到你的部署的 Cloud ID 并创建一个 API 密钥。 <a href="https://www.elastic.co/search-labs/tutorials/install-elasticsearch/elastic-cloud#finding-your-cloud-id" rel="nofollow">了解更多</a>。</p></li>',Es,$,Bs,A,Bt="ℹ️ <code>eland</code> 的安装可能需要几分钟时间。",Gs,v,Ns,q,Zs,E,Gt="首先，你需要连接到你的 Elasticsearch 实例。",ks,B,xs,G,Nt=`Elastic Cloud ID: ··········
Elastic Api Key: ··········
`,Qs,N,_s,Z,Zt="通过以下测试确认 Python 客户端是否已成功连接到你的 Elasticsearch 实例。",Ws,k,Xs,x,kt="这个示例使用了一个小型的电影数据集。",Rs,Q,Ss,_,xt="Done indexing documents into `movies` index!\n",Vs,W,zs,X,Qt="现在，我们将使用 Eland 的 <code>eland_import_hub_model</code> 命令将模型上传到 Elasticsearch。在这个示例中，我们选择了 <code>cross-encoder/ms-marco-MiniLM-L-6-v2</code> 文本相似度模型。",Hs,R,Ls,S,_t=`2024-08-13 17:04:12,386 INFO : Establishing connection to Elasticsearch
2024-08-13 17:04:12,567 INFO : Connected to serverless cluster 'bd8c004c050e4654ad32fb86ab159889'
2024-08-13 17:04:12,568 INFO : Loading HuggingFace transformer tokenizer and model 'cross-encoder/ms-marco-MiniLM-L-6-v2'
/usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:1132: FutureWarning: \`resume_download\` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use \`force_download=True\`.
  warnings.warn(
tokenizer_config.json: 100% 316/316 [00:00<00:00, 1.81MB/s]
config.json: 100% 794/794 [00:00<00:00, 4.09MB/s]
vocab.txt: 100% 232k/232k [00:00<00:00, 2.37MB/s]
special_tokens_map.json: 100% 112/112 [00:00<00:00, 549kB/s]
pytorch_model.bin: 100% 90.9M/90.9M [00:00<00:00, 135MB/s]
STAGE:2024-08-13 17:04:15 1454:1454 ActivityProfilerController.cpp:312] Completed Stage: Warm Up
STAGE:2024-08-13 17:04:15 1454:1454 ActivityProfilerController.cpp:318] Completed Stage: Collection
STAGE:2024-08-13 17:04:15 1454:1454 ActivityProfilerController.cpp:322] Completed Stage: Post Processing
2024-08-13 17:04:18,789 INFO : Creating model with id 'cross-encoder__ms-marco-minilm-l-6-v2'
2024-08-13 17:04:21,123 INFO : Uploading model definition
100% 87/87 [00:55<00:00,  1.57 parts/s]
2024-08-13 17:05:16,416 INFO : Uploading model vocabulary
2024-08-13 17:05:16,987 INFO : Starting model deployment
2024-08-13 17:05:18,238 INFO : Model successfully imported with id 'cross-encoder__ms-marco-minilm-l-6-v2'
`,Fs,V,Ps,z,Wt="接下来，我们将为 <code>rerank</code> 任务创建一个推理端点，以部署和管理我们的模型，并在需要时启动必要的机器学习资源。",Ys,H,Ds,L,Xt="运行以下命令以确认你的推理端点已成功部署。",Ks,F,Os,P,Rt=`⚠️ 当你部署模型时，可能需要在 Kibana（或无服务器）UI 中同步你的机器学习保存对象。<br/>
请前往 <strong>训练模型</strong> 并选择 <strong>同步保存对象</strong>。`,st,Y,tt,D,St="首先，让我们使用一个 <code>standard</code> 检索器来测试一些词汇（或全文）搜索，然后我们将比较在加入语义重排序后所带来的改进。",lt,K,et,O,Vt="假设我们模糊记得有一部关于吃人肉的杀手的著名电影。为了论证，假设我们暂时忘记了“食人者”这个词。",at,ss,zt='让我们执行一个 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html" rel="nofollow"><code>query_string</code> 查询</a>，在 Elasticsearch 文档的 <code>plot</code> 字段中查找短语 “flesh-eating bad guy”。',nt,ts,it,ls,Ht=`No search results found
`,pt,es,Lt="没有结果！不幸的是，我们没有找到与 “flesh-eating bad guy” 精确匹配的结果。由于我们没有关于 Elasticsearch 数据中确切措辞的更多信息，我们需要扩大搜索范围。",ot,as,ct,ns,Ft="这个词汇查询在我们的 Elasticsearch 文档的 <code>plot</code> 和 <code>genre</code> 字段中执行了一个标准的关键词搜索，查找术语 “crime”。",Mt,is,rt,ps,Pt=`Title: The Godfather
Plot: An organized crime dynasty's aging patriarch transfers control of his clandestine empire to his reluctant son.

Title: Goodfellas
Plot: The story of Henry Hill and his life in the mob, covering his relationship with his wife Karen Hill and his mob partners Jimmy Conway and Tommy DeVito in the Italian-American crime syndicate.

Title: The Silence of the Lambs
Plot: A young F.B.I. cadet must receive the help of an incarcerated and manipulative cannibal killer to help catch another serial killer, a madman who skins his victims.

Title: Pulp Fiction
Plot: The lives of two mob hitmen, a boxer, a gangster and his wife, and a pair of diner bandits intertwine in four tales of violence and redemption.

Title: Se7en
Plot: Two detectives, a rookie and a veteran, hunt a serial killer who uses the seven deadly sins as his motives.

Title: The Departed
Plot: An undercover cop and a mole in the police attempt to identify each other while infiltrating an Irish gang in South Boston.

Title: The Usual Suspects
Plot: A sole survivor tells of the twisty events leading up to a horrific gun battle on a boat, which began when five criminals met at a seemingly random police lineup.

Title: The Dark Knight
Plot: When the menace known as the Joker wreaks havoc and chaos on the people of Gotham, Batman must accept one of the greatest psychological and physical tests of his ability to fight injustice.
`,ht,os,Yt="好多了！至少现在我们有了一些结果。我们扩大了搜索标准，以提高找到相关结果的机会。",mt,cs,Dt="不过，这些结果在我们原始查询 “flesh-eating bad guy” 的语境下并不是很精确。我们可以看到，“沉默的羔羊”出现在结果列表的中间，这是一个使用了通用 <code>match</code> 查询的结果。让我们看看是否可以使用我们的语义重排序模型，来更接近搜索者的原始意图。",jt,Ms,yt,rs,Kt="在以下的 <code>retriever</code> 语法中，我们将标准查询检索器包装在一个 <code>text_similarity_reranker</code> 中。这样，我们就可以利用我们部署到 Elasticsearch 的 NLP 模型，根据短语 “flesh-eating bad guy” 对结果进行重排序。",Jt,hs,Tt,ms,Ot=`Title: The Silence of the Lambs
Plot: A young F.B.I. cadet must receive the help of an incarcerated and manipulative cannibal killer to help catch another serial killer, a madman who skins his victims.

Title: Pulp Fiction
Plot: The lives of two mob hitmen, a boxer, a gangster and his wife, and a pair of diner bandits intertwine in four tales of violence and redemption.

Title: Se7en
Plot: Two detectives, a rookie and a veteran, hunt a serial killer who uses the seven deadly sins as his motives.

Title: Goodfellas
Plot: The story of Henry Hill and his life in the mob, covering his relationship with his wife Karen Hill and his mob partners Jimmy Conway and Tommy DeVito in the Italian-American crime syndicate.

Title: The Dark Knight
Plot: When the menace known as the Joker wreaks havoc and chaos on the people of Gotham, Batman must accept one of the greatest psychological and physical tests of his ability to fight injustice.

Title: The Godfather
Plot: An organized crime dynasty's aging patriarch transfers control of his clandestine empire to his reluctant son.

Title: The Departed
Plot: An undercover cop and a mole in the police attempt to identify each other while infiltrating an Irish gang in South Boston.

Title: The Usual Suspects
Plot: A sole survivor tells of the twisty events leading up to a horrific gun battle on a boat, which began when five criminals met at a seemingly random police lineup.
`,ut,js,sl="成功了！“沉默的羔羊”是我们的首个结果。语义重排序通过解析自然语言查询，帮助我们找到最相关的结果，克服了依赖精确匹配的词汇搜索的局限性。",wt,ys,tl="语义重排序通过几个步骤实现了语义搜索，而无需生成和存储嵌入。能够在 Elasticsearch 集群中本地使用托管在 Hugging Face 上的开源模型，非常适合原型开发、测试和构建搜索体验。",Ut,Js,gt,Ts,ll='<li>在本示例中，我们选择了 <a href="https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-6-v2" rel="nofollow"><code>cross-encoder/ms-marco-MiniLM-L-6-v2</code></a> 文本相似度模型。请参考 <a href="https://www.elastic.co/guide/en/machine-learning/8.15/ml-nlp-model-ref.html#ml-nlp-model-ref-text-similarity" rel="nofollow">Elastic NLP 模型参考</a> 获取 Elasticsearch 支持的第三方文本相似度模型列表。</li> <li>了解更多关于 <a href="https://www.elastic.co/search-labs/integrations/hugging-face" rel="nofollow">将 Hugging Face 与 Elasticsearch 集成</a> 的信息。</li> <li>查看 Elastic 的 Python 笔记本目录，访问 <a href="https://github.com/elastic/elasticsearch-labs/tree/main/notebooks" rel="nofollow"><code>elasticsearch-labs</code> 仓库</a>。</li> <li>了解更多关于 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/retrievers-reranking-overview.html" rel="nofollow">Elasticsearch 中的检索器和重排序</a>。</li>',dt,us,It,Us,Ct;return u=new hl({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/cookbook/blob/main/notebooks/zh-CN/semantic_reranking_elasticsearch.ipynb"}]}}),w=new y({props:{title:"使用 Elasticsearch 和 Hugging Face 进行语义重排序",local:"使用-elasticsearch-和-hugging-face-进行语义重排序",headingTag:"h1"}}),C=new y({props:{title:"🧰 必备条件",local:"-必备条件",headingTag:"h2"}}),$=new y({props:{title:"安装并导入包",local:"安装并导入包",headingTag:"h2"}}),v=new J({props:{code:"IXBpcCUyMGluc3RhbGwlMjAtcVUlMjBlbGFzdGljc2VhcmNoJTBBIXBpcCUyMGluc3RhbGwlMjBlbGFuZCU1QnB5dG9yY2glNUQlMEFmcm9tJTIwZWxhc3RpY3NlYXJjaCUyMGltcG9ydCUyMEVsYXN0aWNzZWFyY2glMkMlMjBoZWxwZXJz",highlighted:`!pip install -qU elasticsearch
!pip install eland[pytorch]
<span class="hljs-keyword">from</span> elasticsearch <span class="hljs-keyword">import</span> Elasticsearch, helpers`,wrap:!1}}),q=new y({props:{title:"初始化 Elasticsearch Python 客户端",local:"初始化-elasticsearch-python-客户端",headingTag:"h2"}}),B=new J({props:{code:"ZnJvbSUyMGdldHBhc3MlMjBpbXBvcnQlMjBnZXRwYXNzJTBBJTBBJTIzJTIwaHR0cHMlM0ElMkYlMkZ3d3cuZWxhc3RpYy5jbyUyRnNlYXJjaC1sYWJzJTJGdHV0b3JpYWxzJTJGaW5zdGFsbC1lbGFzdGljc2VhcmNoJTJGZWxhc3RpYy1jbG91ZCUyM2ZpbmRpbmcteW91ci1jbG91ZC1pZCUwQUVMQVNUSUNfQ0xPVURfSUQlMjAlM0QlMjBnZXRwYXNzKCUyMkVsYXN0aWMlMjBDbG91ZCUyMElEJTNBJTIwJTIyKSUwQSUwQSUyMyUyMGh0dHBzJTNBJTJGJTJGd3d3LmVsYXN0aWMuY28lMkZzZWFyY2gtbGFicyUyRnR1dG9yaWFscyUyRmluc3RhbGwtZWxhc3RpY3NlYXJjaCUyRmVsYXN0aWMtY2xvdWQlMjNjcmVhdGluZy1hbi1hcGkta2V5JTBBRUxBU1RJQ19BUElfS0VZJTIwJTNEJTIwZ2V0cGFzcyglMjJFbGFzdGljJTIwQXBpJTIwS2V5JTNBJTIwJTIyKSUwQSUwQSUyMyUyMENyZWF0ZSUyMHRoZSUyMGNsaWVudCUyMGluc3RhbmNlJTBBY2xpZW50JTIwJTNEJTIwRWxhc3RpY3NlYXJjaCglMEElMjAlMjAlMjAlMjAlMjMlMjBGb3IlMjBsb2NhbCUyMGRldmVsb3BtZW50JTBBJTIwJTIwJTIwJTIwJTIzJTIwaG9zdHMlM0QlNUIlMjJodHRwJTNBJTJGJTJGbG9jYWxob3N0JTNBOTIwMCUyMiU1RCUwQSUyMCUyMCUyMCUyMGNsb3VkX2lkJTNERUxBU1RJQ19DTE9VRF9JRCUyQyUwQSUyMCUyMCUyMCUyMGFwaV9rZXklM0RFTEFTVElDX0FQSV9LRVklMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> getpass <span class="hljs-keyword">import</span> getpass

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># https://www.elastic.co/search-labs/tutorials/install-elasticsearch/elastic-cloud#finding-your-cloud-id</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>ELASTIC_CLOUD_ID = getpass(<span class="hljs-string">&quot;Elastic Cloud ID: &quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># https://www.elastic.co/search-labs/tutorials/install-elasticsearch/elastic-cloud#creating-an-api-key</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>ELASTIC_API_KEY = getpass(<span class="hljs-string">&quot;Elastic Api Key: &quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Create the client instance</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>client = Elasticsearch(
<span class="hljs-meta">... </span>    <span class="hljs-comment"># For local development</span>
<span class="hljs-meta">... </span>    <span class="hljs-comment"># hosts=[&quot;http://localhost:9200&quot;]</span>
<span class="hljs-meta">... </span>    cloud_id=ELASTIC_CLOUD_ID,
<span class="hljs-meta">... </span>    api_key=ELASTIC_API_KEY,
<span class="hljs-meta">... </span>)`,wrap:!1}}),N=new y({props:{title:"测试连接",local:"测试连接",headingTag:"h2"}}),k=new J({props:{code:"cHJpbnQoY2xpZW50LmluZm8oKSk=",highlighted:'<span class="hljs-built_in">print</span>(client.info())',wrap:!1}}),Q=new J({props:{code:"ZnJvbSUyMHVybGxpYi5yZXF1ZXN0JTIwaW1wb3J0JTIwdXJsb3BlbiUwQWltcG9ydCUyMGpzb24lMEFpbXBvcnQlMjB0aW1lJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGbGVlbXRob21wbyUyRnNtYWxsLW1vdmllcyUyRnJhdyUyRm1haW4lMkZzbWFsbC1tb3ZpZXMuanNvbiUyMiUwQXJlc3BvbnNlJTIwJTNEJTIwdXJsb3Blbih1cmwpJTBBJTBBJTIzJTIwTG9hZCUyMHRoZSUyMHJlc3BvbnNlJTIwZGF0YSUyMGludG8lMjBhJTIwSlNPTiUyMG9iamVjdCUwQWRhdGFfanNvbiUyMCUzRCUyMGpzb24ubG9hZHMocmVzcG9uc2UucmVhZCgpKSUwQSUwQSUyMyUyMFByZXBhcmUlMjB0aGUlMjBkb2N1bWVudHMlMjB0byUyMGJlJTIwaW5kZXhlZCUwQWRvY3VtZW50cyUyMCUzRCUyMCU1QiU1RCUwQWZvciUyMGRvYyUyMGluJTIwZGF0YV9qc29uJTNBJTBBJTIwJTIwJTIwJTIwZG9jdW1lbnRzLmFwcGVuZCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJfaW5kZXglMjIlM0ElMjAlMjJtb3ZpZXMlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJfc291cmNlJTIyJTNBJTIwZG9jJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwKSUwQSUwQSUyMyUyMFVzZSUyMGhlbHBlcnMuYnVsayUyMHRvJTIwaW5kZXglMEFoZWxwZXJzLmJ1bGsoY2xpZW50JTJDJTIwZG9jdW1lbnRzKSUwQSUwQXByaW50KCUyMkRvbmUlMjBpbmRleGluZyUyMGRvY3VtZW50cyUyMGludG8lMjAlNjBtb3ZpZXMlNjAlMjBpbmRleCElMjIpJTBBdGltZS5zbGVlcCgzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> urllib.request <span class="hljs-keyword">import</span> urlopen
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> json
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> time

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/leemthompo/small-movies/raw/main/small-movies.json&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = urlopen(url)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load the response data into a JSON object</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>data_json = json.loads(response.read())

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Prepare the documents to be indexed</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>documents = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> doc <span class="hljs-keyword">in</span> data_json:
<span class="hljs-meta">... </span>    documents.append(
<span class="hljs-meta">... </span>        {
<span class="hljs-meta">... </span>            <span class="hljs-string">&quot;_index&quot;</span>: <span class="hljs-string">&quot;movies&quot;</span>,
<span class="hljs-meta">... </span>            <span class="hljs-string">&quot;_source&quot;</span>: doc,
<span class="hljs-meta">... </span>        }
<span class="hljs-meta">... </span>    )

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Use helpers.bulk to index</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>helpers.bulk(client, documents)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Done indexing documents into \`movies\` index!&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>time.sleep(<span class="hljs-number">3</span>)`,wrap:!1}}),W=new y({props:{title:"使用 Eland 上传 Hugging Face 模型",local:"使用-eland-上传-hugging-face-模型",headingTag:"h2"}}),R=new J({props:{code:"IWVsYW5kX2ltcG9ydF9odWJfbW9kZWwlMjAlNUMlMEElMjAlMjAtLWNsb3VkLWlkJTIwJTI0RUxBU1RJQ19DTE9VRF9JRCUyMCU1QyUwQSUyMCUyMC0tZXMtYXBpLWtleSUyMCUyNEVMQVNUSUNfQVBJX0tFWSUyMCU1QyUwQSUyMCUyMC0taHViLW1vZGVsLWlkJTIwY3Jvc3MtZW5jb2RlciUyRm1zLW1hcmNvLU1pbmlMTS1MLTYtdjIlMjAlNUMlMEElMjAlMjAtLXRhc2stdHlwZSUyMHRleHRfc2ltaWxhcml0eSUyMCU1QyUwQSUyMCUyMC0tY2xlYXItcHJldmlvdXMlMjAlNUMlMEElMjAlMjAtLXN0YXJ0",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>!eland_import_hub_model \\
<span class="hljs-meta">... </span>  --cloud-<span class="hljs-built_in">id</span> $ELASTIC_CLOUD_ID \\
<span class="hljs-meta">... </span>  --es-api-key $ELASTIC_API_KEY \\
<span class="hljs-meta">... </span>  --hub-model-<span class="hljs-built_in">id</span> cross-encoder/ms-marco-MiniLM-L-<span class="hljs-number">6</span>-v2 \\
<span class="hljs-meta">... </span>  --task-<span class="hljs-built_in">type</span> text_similarity \\
<span class="hljs-meta">... </span>  --clear-previous \\
<span class="hljs-meta">... </span>  --start`,wrap:!1}}),V=new y({props:{title:"创建推理端点",local:"创建推理端点",headingTag:"h2"}}),H=new J({props:{code:"Y2xpZW50LmluZmVyZW5jZS5wdXQoJTBBJTIwJTIwJTIwJTIwdGFza190eXBlJTNEJTIycmVyYW5rJTIyJTJDJTBBJTIwJTIwJTIwJTIwaW5mZXJlbmNlX2lkJTNEJTIybXktbXNtYXJjby1taW5pbG0tbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjBpbmZlcmVuY2VfY29uZmlnJTNEJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyc2VydmljZSUyMiUzQSUyMCUyMmVsYXN0aWNzZWFyY2glMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJzZXJ2aWNlX3NldHRpbmdzJTIyJTNBJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIybW9kZWxfaWQlMjIlM0ElMjAlMjJjcm9zcy1lbmNvZGVyX19tcy1tYXJjby1taW5pbG0tbC02LXYyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIybnVtX2FsbG9jYXRpb25zJTIyJTNBJTIwMSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMm51bV90aHJlYWRzJTIyJTNBJTIwMSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSk=",highlighted:`client.inference.put(
    task_type=<span class="hljs-string">&quot;rerank&quot;</span>,
    inference_id=<span class="hljs-string">&quot;my-msmarco-minilm-model&quot;</span>,
    inference_config={
        <span class="hljs-string">&quot;service&quot;</span>: <span class="hljs-string">&quot;elasticsearch&quot;</span>,
        <span class="hljs-string">&quot;service_settings&quot;</span>: {
            <span class="hljs-string">&quot;model_id&quot;</span>: <span class="hljs-string">&quot;cross-encoder__ms-marco-minilm-l-6-v2&quot;</span>,
            <span class="hljs-string">&quot;num_allocations&quot;</span>: <span class="hljs-number">1</span>,
            <span class="hljs-string">&quot;num_threads&quot;</span>: <span class="hljs-number">1</span>,
        },
    },
)`,wrap:!1}}),F=new J({props:{code:"Y2xpZW50LmluZmVyZW5jZS5nZXQoKQ==",highlighted:"client.inference.get()",wrap:!1}}),Y=new y({props:{title:"词汇查询",local:"词汇查询",headingTag:"h2"}}),K=new y({props:{title:"使用 query_string 查询进行词汇匹配",local:"使用-querystring-查询进行词汇匹配",headingTag:"h3"}}),ts=new J({props:{code:"cmVzcCUyMCUzRCUyMGNsaWVudC5zZWFyY2goJTBBJTIwJTIwJTIwJTIwaW5kZXglM0QlMjJtb3ZpZXMlMjIlMkMlMEElMjAlMjAlMjAlMjByZXRyaWV2ZXIlM0QlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJzdGFuZGFyZCUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnF1ZXJ5JTIyJTNBJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycXVlcnlfc3RyaW5nJTIyJTNBJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIycXVlcnklMjIlM0ElMjAlMjJmbGVzaC1lYXRpbmclMjBiYWQlMjBndXklMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJkZWZhdWx0X2ZpZWxkJTIyJTNBJTIwJTIycGxvdCUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSklMEElMEFpZiUyMHJlc3AlNUIlMjJoaXRzJTIyJTVEJTVCJTIyaGl0cyUyMiU1RCUzQSUwQSUyMCUyMCUyMCUyMGZvciUyMGhpdCUyMGluJTIwcmVzcCU1QiUyMmhpdHMlMjIlNUQlNUIlMjJoaXRzJTIyJTVEJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdGl0bGUlMjAlM0QlMjBoaXQlNUIlMjJfc291cmNlJTIyJTVEJTVCJTIydGl0bGUlMjIlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwbG90JTIwJTNEJTIwaGl0JTVCJTIyX3NvdXJjZSUyMiU1RCU1QiUyMnBsb3QlMjIlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwcmludChmJTIyVGl0bGUlM0ElMjAlN0J0aXRsZSU3RCU1Q25QbG90JTNBJTIwJTdCcGxvdCU3RCU1Q24lMjIpJTBBZWxzZSUzQSUwQSUyMCUyMCUyMCUyMHByaW50KCUyMk5vJTIwc2VhcmNoJTIwcmVzdWx0cyUyMGZvdW5kJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>resp = client.search(
<span class="hljs-meta">... </span>    index=<span class="hljs-string">&quot;movies&quot;</span>,
<span class="hljs-meta">... </span>    retriever={
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;standard&quot;</span>: {
<span class="hljs-meta">... </span>            <span class="hljs-string">&quot;query&quot;</span>: {
<span class="hljs-meta">... </span>                <span class="hljs-string">&quot;query_string&quot;</span>: {
<span class="hljs-meta">... </span>                    <span class="hljs-string">&quot;query&quot;</span>: <span class="hljs-string">&quot;flesh-eating bad guy&quot;</span>,
<span class="hljs-meta">... </span>                    <span class="hljs-string">&quot;default_field&quot;</span>: <span class="hljs-string">&quot;plot&quot;</span>,
<span class="hljs-meta">... </span>                }
<span class="hljs-meta">... </span>            }
<span class="hljs-meta">... </span>        }
<span class="hljs-meta">... </span>    },
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">if</span> resp[<span class="hljs-string">&quot;hits&quot;</span>][<span class="hljs-string">&quot;hits&quot;</span>]:
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> hit <span class="hljs-keyword">in</span> resp[<span class="hljs-string">&quot;hits&quot;</span>][<span class="hljs-string">&quot;hits&quot;</span>]:
<span class="hljs-meta">... </span>        title = hit[<span class="hljs-string">&quot;_source&quot;</span>][<span class="hljs-string">&quot;title&quot;</span>]
<span class="hljs-meta">... </span>        plot = hit[<span class="hljs-string">&quot;_source&quot;</span>][<span class="hljs-string">&quot;plot&quot;</span>]
<span class="hljs-meta">... </span>        <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Title: <span class="hljs-subst">{title}</span>\\nPlot: <span class="hljs-subst">{plot}</span>\\n&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;No search results found&quot;</span>)`,wrap:!1}}),as=new y({props:{title:"简单的 multi_match 查询",local:"简单的-multimatch-查询",headingTag:"h3"}}),is=new J({props:{code:"cmVzcCUyMCUzRCUyMGNsaWVudC5zZWFyY2goJTBBJTIwJTIwJTIwJTIwaW5kZXglM0QlMjJtb3ZpZXMlMjIlMkMlMEElMjAlMjAlMjAlMjByZXRyaWV2ZXIlM0QlN0IlMjJzdGFuZGFyZCUyMiUzQSUyMCU3QiUyMnF1ZXJ5JTIyJTNBJTIwJTdCJTIybXVsdGlfbWF0Y2glMjIlM0ElMjAlN0IlMjJxdWVyeSUyMiUzQSUyMCUyMmNyaW1lJTIyJTJDJTIwJTIyZmllbGRzJTIyJTNBJTIwJTVCJTIycGxvdCUyMiUyQyUyMCUyMmdlbnJlJTIyJTVEJTdEJTdEJTdEJTdEJTJDJTBBKSUwQSUwQWZvciUyMGhpdCUyMGluJTIwcmVzcCU1QiUyMmhpdHMlMjIlNUQlNUIlMjJoaXRzJTIyJTVEJTNBJTBBJTIwJTIwJTIwJTIwdGl0bGUlMjAlM0QlMjBoaXQlNUIlMjJfc291cmNlJTIyJTVEJTVCJTIydGl0bGUlMjIlNUQlMEElMjAlMjAlMjAlMjBwbG90JTIwJTNEJTIwaGl0JTVCJTIyX3NvdXJjZSUyMiU1RCU1QiUyMnBsb3QlMjIlNUQlMEElMjAlMjAlMjAlMjBwcmludChmJTIyVGl0bGUlM0ElMjAlN0J0aXRsZSU3RCU1Q25QbG90JTNBJTIwJTdCcGxvdCU3RCU1Q24lMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>resp = client.search(
<span class="hljs-meta">... </span>    index=<span class="hljs-string">&quot;movies&quot;</span>,
<span class="hljs-meta">... </span>    retriever={<span class="hljs-string">&quot;standard&quot;</span>: {<span class="hljs-string">&quot;query&quot;</span>: {<span class="hljs-string">&quot;multi_match&quot;</span>: {<span class="hljs-string">&quot;query&quot;</span>: <span class="hljs-string">&quot;crime&quot;</span>, <span class="hljs-string">&quot;fields&quot;</span>: [<span class="hljs-string">&quot;plot&quot;</span>, <span class="hljs-string">&quot;genre&quot;</span>]}}}},
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> hit <span class="hljs-keyword">in</span> resp[<span class="hljs-string">&quot;hits&quot;</span>][<span class="hljs-string">&quot;hits&quot;</span>]:
<span class="hljs-meta">... </span>    title = hit[<span class="hljs-string">&quot;_source&quot;</span>][<span class="hljs-string">&quot;title&quot;</span>]
<span class="hljs-meta">... </span>    plot = hit[<span class="hljs-string">&quot;_source&quot;</span>][<span class="hljs-string">&quot;plot&quot;</span>]
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Title: <span class="hljs-subst">{title}</span>\\nPlot: <span class="hljs-subst">{plot}</span>\\n&quot;</span>)`,wrap:!1}}),Ms=new y({props:{title:"语义重排序",local:"语义重排序",headingTag:"h2"}}),hs=new J({props:{code:"cmVzcCUyMCUzRCUyMGNsaWVudC5zZWFyY2goJTBBJTIwJTIwJTIwJTIwaW5kZXglM0QlMjJtb3ZpZXMlMjIlMkMlMEElMjAlMjAlMjAlMjByZXRyaWV2ZXIlM0QlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ0ZXh0X3NpbWlsYXJpdHlfcmVyYW5rZXIlMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyZXRyaWV2ZXIlMjIlM0ElMjAlN0IlMjJzdGFuZGFyZCUyMiUzQSUyMCU3QiUyMnF1ZXJ5JTIyJTNBJTIwJTdCJTIybXVsdGlfbWF0Y2glMjIlM0ElMjAlN0IlMjJxdWVyeSUyMiUzQSUyMCUyMmNyaW1lJTIyJTJDJTIwJTIyZmllbGRzJTIyJTNBJTIwJTVCJTIycGxvdCUyMiUyQyUyMCUyMmdlbnJlJTIyJTVEJTdEJTdEJTdEJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyZmllbGQlMjIlM0ElMjAlMjJwbG90JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyaW5mZXJlbmNlX2lkJTIyJTNBJTIwJTIybXktbXNtYXJjby1taW5pbG0tbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJpbmZlcmVuY2VfdGV4dCUyMiUzQSUyMCUyMmZsZXNoLWVhdGluZyUyMGJhZCUyMGd1eSUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSklMEElMEFmb3IlMjBoaXQlMjBpbiUyMHJlc3AlNUIlMjJoaXRzJTIyJTVEJTVCJTIyaGl0cyUyMiU1RCUzQSUwQSUyMCUyMCUyMCUyMHRpdGxlJTIwJTNEJTIwaGl0JTVCJTIyX3NvdXJjZSUyMiU1RCU1QiUyMnRpdGxlJTIyJTVEJTBBJTIwJTIwJTIwJTIwcGxvdCUyMCUzRCUyMGhpdCU1QiUyMl9zb3VyY2UlMjIlNUQlNUIlMjJwbG90JTIyJTVEJTBBJTIwJTIwJTIwJTIwcHJpbnQoZiUyMlRpdGxlJTNBJTIwJTdCdGl0bGUlN0QlNUNuUGxvdCUzQSUyMCU3QnBsb3QlN0QlNUNuJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>resp = client.search(
<span class="hljs-meta">... </span>    index=<span class="hljs-string">&quot;movies&quot;</span>,
<span class="hljs-meta">... </span>    retriever={
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;text_similarity_reranker&quot;</span>: {
<span class="hljs-meta">... </span>            <span class="hljs-string">&quot;retriever&quot;</span>: {<span class="hljs-string">&quot;standard&quot;</span>: {<span class="hljs-string">&quot;query&quot;</span>: {<span class="hljs-string">&quot;multi_match&quot;</span>: {<span class="hljs-string">&quot;query&quot;</span>: <span class="hljs-string">&quot;crime&quot;</span>, <span class="hljs-string">&quot;fields&quot;</span>: [<span class="hljs-string">&quot;plot&quot;</span>, <span class="hljs-string">&quot;genre&quot;</span>]}}}},
<span class="hljs-meta">... </span>            <span class="hljs-string">&quot;field&quot;</span>: <span class="hljs-string">&quot;plot&quot;</span>,
<span class="hljs-meta">... </span>            <span class="hljs-string">&quot;inference_id&quot;</span>: <span class="hljs-string">&quot;my-msmarco-minilm-model&quot;</span>,
<span class="hljs-meta">... </span>            <span class="hljs-string">&quot;inference_text&quot;</span>: <span class="hljs-string">&quot;flesh-eating bad guy&quot;</span>,
<span class="hljs-meta">... </span>        }
<span class="hljs-meta">... </span>    },
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> hit <span class="hljs-keyword">in</span> resp[<span class="hljs-string">&quot;hits&quot;</span>][<span class="hljs-string">&quot;hits&quot;</span>]:
<span class="hljs-meta">... </span>    title = hit[<span class="hljs-string">&quot;_source&quot;</span>][<span class="hljs-string">&quot;title&quot;</span>]
<span class="hljs-meta">... </span>    plot = hit[<span class="hljs-string">&quot;_source&quot;</span>][<span class="hljs-string">&quot;plot&quot;</span>]
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Title: <span class="hljs-subst">{title}</span>\\nPlot: <span class="hljs-subst">{plot}</span>\\n&quot;</span>)`,wrap:!1}}),Js=new y({props:{title:"了解更多",local:"了解更多",headingTag:"h2"}}),us=new ml({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/zh-CN/semantic_reranking_elasticsearch.md"}}),{c(){T=i("meta"),gs=a(),ws=i("p"),ds=a(),c(u.$$.fragment),Is=a(),c(w.$$.fragment),Cs=a(),U=i("p"),U.innerHTML=bt,fs=a(),g=i("p"),g.innerHTML=$t,bs=a(),d=i("p"),d.textContent=At,$s=a(),I=i("ul"),I.innerHTML=vt,As=a(),c(C.$$.fragment),vs=a(),f=i("p"),f.textContent=qt,qs=a(),b=i("ul"),b.innerHTML=Et,Es=a(),c($.$$.fragment),Bs=a(),A=i("p"),A.innerHTML=Bt,Gs=a(),c(v.$$.fragment),Ns=a(),c(q.$$.fragment),Zs=a(),E=i("p"),E.textContent=Gt,ks=a(),c(B.$$.fragment),xs=a(),G=i("pre"),G.textContent=Nt,Qs=a(),c(N.$$.fragment),_s=a(),Z=i("p"),Z.textContent=Zt,Ws=a(),c(k.$$.fragment),Xs=a(),x=i("p"),x.textContent=kt,Rs=a(),c(Q.$$.fragment),Ss=a(),_=i("pre"),_.textContent=xt,Vs=a(),c(W.$$.fragment),zs=a(),X=i("p"),X.innerHTML=Qt,Hs=a(),c(R.$$.fragment),Ls=a(),S=i("pre"),S.textContent=_t,Fs=a(),c(V.$$.fragment),Ps=a(),z=i("p"),z.innerHTML=Wt,Ys=a(),c(H.$$.fragment),Ds=a(),L=i("p"),L.textContent=Xt,Ks=a(),c(F.$$.fragment),Os=a(),P=i("p"),P.innerHTML=Rt,st=a(),c(Y.$$.fragment),tt=a(),D=i("p"),D.innerHTML=St,lt=a(),c(K.$$.fragment),et=a(),O=i("p"),O.textContent=Vt,at=a(),ss=i("p"),ss.innerHTML=zt,nt=a(),c(ts.$$.fragment),it=a(),ls=i("pre"),ls.textContent=Ht,pt=a(),es=i("p"),es.textContent=Lt,ot=a(),c(as.$$.fragment),ct=a(),ns=i("p"),ns.innerHTML=Ft,Mt=a(),c(is.$$.fragment),rt=a(),ps=i("pre"),ps.textContent=Pt,ht=a(),os=i("p"),os.textContent=Yt,mt=a(),cs=i("p"),cs.innerHTML=Dt,jt=a(),c(Ms.$$.fragment),yt=a(),rs=i("p"),rs.innerHTML=Kt,Jt=a(),c(hs.$$.fragment),Tt=a(),ms=i("pre"),ms.textContent=Ot,ut=a(),js=i("p"),js.textContent=sl,wt=a(),ys=i("p"),ys.textContent=tl,Ut=a(),c(Js.$$.fragment),gt=a(),Ts=i("ul"),Ts.innerHTML=ll,dt=a(),c(us.$$.fragment),It=a(),Us=i("p"),this.h()},l(s){const t=Ml("svelte-u9bgzb",document.head);T=p(t,"META",{name:!0,content:!0}),t.forEach(l),gs=n(s),ws=p(s,"P",{}),el(ws).forEach(l),ds=n(s),M(u.$$.fragment,s),Is=n(s),M(w.$$.fragment,s),Cs=n(s),U=p(s,"P",{"data-svelte-h":!0}),o(U)!=="svelte-cq4nha"&&(U.innerHTML=bt),fs=n(s),g=p(s,"P",{"data-svelte-h":!0}),o(g)!=="svelte-1ckcjxc"&&(g.innerHTML=$t),bs=n(s),d=p(s,"P",{"data-svelte-h":!0}),o(d)!=="svelte-pjmzo6"&&(d.textContent=At),$s=n(s),I=p(s,"UL",{"data-svelte-h":!0}),o(I)!=="svelte-17y1h9w"&&(I.innerHTML=vt),As=n(s),M(C.$$.fragment,s),vs=n(s),f=p(s,"P",{"data-svelte-h":!0}),o(f)!=="svelte-1aj4rwe"&&(f.textContent=qt),qs=n(s),b=p(s,"UL",{"data-svelte-h":!0}),o(b)!=="svelte-g1ku20"&&(b.innerHTML=Et),Es=n(s),M($.$$.fragment,s),Bs=n(s),A=p(s,"P",{"data-svelte-h":!0}),o(A)!=="svelte-hw95n9"&&(A.innerHTML=Bt),Gs=n(s),M(v.$$.fragment,s),Ns=n(s),M(q.$$.fragment,s),Zs=n(s),E=p(s,"P",{"data-svelte-h":!0}),o(E)!=="svelte-1gzwu60"&&(E.textContent=Gt),ks=n(s),M(B.$$.fragment,s),xs=n(s),G=p(s,"PRE",{"data-svelte-h":!0}),o(G)!=="svelte-1x47hmf"&&(G.textContent=Nt),Qs=n(s),M(N.$$.fragment,s),_s=n(s),Z=p(s,"P",{"data-svelte-h":!0}),o(Z)!=="svelte-gj2uvi"&&(Z.textContent=Zt),Ws=n(s),M(k.$$.fragment,s),Xs=n(s),x=p(s,"P",{"data-svelte-h":!0}),o(x)!=="svelte-16uiuvb"&&(x.textContent=kt),Rs=n(s),M(Q.$$.fragment,s),Ss=n(s),_=p(s,"PRE",{"data-svelte-h":!0}),o(_)!=="svelte-1m77zdm"&&(_.textContent=xt),Vs=n(s),M(W.$$.fragment,s),zs=n(s),X=p(s,"P",{"data-svelte-h":!0}),o(X)!=="svelte-nbuvli"&&(X.innerHTML=Qt),Hs=n(s),M(R.$$.fragment,s),Ls=n(s),S=p(s,"PRE",{"data-svelte-h":!0}),o(S)!=="svelte-1o6q6qn"&&(S.textContent=_t),Fs=n(s),M(V.$$.fragment,s),Ps=n(s),z=p(s,"P",{"data-svelte-h":!0}),o(z)!=="svelte-1g9m4gs"&&(z.innerHTML=Wt),Ys=n(s),M(H.$$.fragment,s),Ds=n(s),L=p(s,"P",{"data-svelte-h":!0}),o(L)!=="svelte-1gtbyax"&&(L.textContent=Xt),Ks=n(s),M(F.$$.fragment,s),Os=n(s),P=p(s,"P",{"data-svelte-h":!0}),o(P)!=="svelte-ybmt89"&&(P.innerHTML=Rt),st=n(s),M(Y.$$.fragment,s),tt=n(s),D=p(s,"P",{"data-svelte-h":!0}),o(D)!=="svelte-1iwnfi3"&&(D.innerHTML=St),lt=n(s),M(K.$$.fragment,s),et=n(s),O=p(s,"P",{"data-svelte-h":!0}),o(O)!=="svelte-jpohc3"&&(O.textContent=Vt),at=n(s),ss=p(s,"P",{"data-svelte-h":!0}),o(ss)!=="svelte-sqojhj"&&(ss.innerHTML=zt),nt=n(s),M(ts.$$.fragment,s),it=n(s),ls=p(s,"PRE",{"data-svelte-h":!0}),o(ls)!=="svelte-k5qxm1"&&(ls.textContent=Ht),pt=n(s),es=p(s,"P",{"data-svelte-h":!0}),o(es)!=="svelte-1fn7x3h"&&(es.textContent=Lt),ot=n(s),M(as.$$.fragment,s),ct=n(s),ns=p(s,"P",{"data-svelte-h":!0}),o(ns)!=="svelte-15tuuzt"&&(ns.innerHTML=Ft),Mt=n(s),M(is.$$.fragment,s),rt=n(s),ps=p(s,"PRE",{"data-svelte-h":!0}),o(ps)!=="svelte-t0ny4t"&&(ps.textContent=Pt),ht=n(s),os=p(s,"P",{"data-svelte-h":!0}),o(os)!=="svelte-456bk1"&&(os.textContent=Yt),mt=n(s),cs=p(s,"P",{"data-svelte-h":!0}),o(cs)!=="svelte-xx2jb6"&&(cs.innerHTML=Dt),jt=n(s),M(Ms.$$.fragment,s),yt=n(s),rs=p(s,"P",{"data-svelte-h":!0}),o(rs)!=="svelte-yqfmn6"&&(rs.innerHTML=Kt),Jt=n(s),M(hs.$$.fragment,s),Tt=n(s),ms=p(s,"PRE",{"data-svelte-h":!0}),o(ms)!=="svelte-vpj64j"&&(ms.textContent=Ot),ut=n(s),js=p(s,"P",{"data-svelte-h":!0}),o(js)!=="svelte-1jkxv1r"&&(js.textContent=sl),wt=n(s),ys=p(s,"P",{"data-svelte-h":!0}),o(ys)!=="svelte-o8g29r"&&(ys.textContent=tl),Ut=n(s),M(Js.$$.fragment,s),gt=n(s),Ts=p(s,"UL",{"data-svelte-h":!0}),o(Ts)!=="svelte-dg281i"&&(Ts.innerHTML=ll),dt=n(s),M(us.$$.fragment,s),It=n(s),Us=p(s,"P",{}),el(Us).forEach(l),this.h()},h(){al(T,"name","hf:doc:metadata"),al(T,"content",yl)},m(s,t){rl(document.head,T),e(s,gs,t),e(s,ws,t),e(s,ds,t),r(u,s,t),e(s,Is,t),r(w,s,t),e(s,Cs,t),e(s,U,t),e(s,fs,t),e(s,g,t),e(s,bs,t),e(s,d,t),e(s,$s,t),e(s,I,t),e(s,As,t),r(C,s,t),e(s,vs,t),e(s,f,t),e(s,qs,t),e(s,b,t),e(s,Es,t),r($,s,t),e(s,Bs,t),e(s,A,t),e(s,Gs,t),r(v,s,t),e(s,Ns,t),r(q,s,t),e(s,Zs,t),e(s,E,t),e(s,ks,t),r(B,s,t),e(s,xs,t),e(s,G,t),e(s,Qs,t),r(N,s,t),e(s,_s,t),e(s,Z,t),e(s,Ws,t),r(k,s,t),e(s,Xs,t),e(s,x,t),e(s,Rs,t),r(Q,s,t),e(s,Ss,t),e(s,_,t),e(s,Vs,t),r(W,s,t),e(s,zs,t),e(s,X,t),e(s,Hs,t),r(R,s,t),e(s,Ls,t),e(s,S,t),e(s,Fs,t),r(V,s,t),e(s,Ps,t),e(s,z,t),e(s,Ys,t),r(H,s,t),e(s,Ds,t),e(s,L,t),e(s,Ks,t),r(F,s,t),e(s,Os,t),e(s,P,t),e(s,st,t),r(Y,s,t),e(s,tt,t),e(s,D,t),e(s,lt,t),r(K,s,t),e(s,et,t),e(s,O,t),e(s,at,t),e(s,ss,t),e(s,nt,t),r(ts,s,t),e(s,it,t),e(s,ls,t),e(s,pt,t),e(s,es,t),e(s,ot,t),r(as,s,t),e(s,ct,t),e(s,ns,t),e(s,Mt,t),r(is,s,t),e(s,rt,t),e(s,ps,t),e(s,ht,t),e(s,os,t),e(s,mt,t),e(s,cs,t),e(s,jt,t),r(Ms,s,t),e(s,yt,t),e(s,rs,t),e(s,Jt,t),r(hs,s,t),e(s,Tt,t),e(s,ms,t),e(s,ut,t),e(s,js,t),e(s,wt,t),e(s,ys,t),e(s,Ut,t),r(Js,s,t),e(s,gt,t),e(s,Ts,t),e(s,dt,t),r(us,s,t),e(s,It,t),e(s,Us,t),Ct=!0},p:il,i(s){Ct||(h(u.$$.fragment,s),h(w.$$.fragment,s),h(C.$$.fragment,s),h($.$$.fragment,s),h(v.$$.fragment,s),h(q.$$.fragment,s),h(B.$$.fragment,s),h(N.$$.fragment,s),h(k.$$.fragment,s),h(Q.$$.fragment,s),h(W.$$.fragment,s),h(R.$$.fragment,s),h(V.$$.fragment,s),h(H.$$.fragment,s),h(F.$$.fragment,s),h(Y.$$.fragment,s),h(K.$$.fragment,s),h(ts.$$.fragment,s),h(as.$$.fragment,s),h(is.$$.fragment,s),h(Ms.$$.fragment,s),h(hs.$$.fragment,s),h(Js.$$.fragment,s),h(us.$$.fragment,s),Ct=!0)},o(s){m(u.$$.fragment,s),m(w.$$.fragment,s),m(C.$$.fragment,s),m($.$$.fragment,s),m(v.$$.fragment,s),m(q.$$.fragment,s),m(B.$$.fragment,s),m(N.$$.fragment,s),m(k.$$.fragment,s),m(Q.$$.fragment,s),m(W.$$.fragment,s),m(R.$$.fragment,s),m(V.$$.fragment,s),m(H.$$.fragment,s),m(F.$$.fragment,s),m(Y.$$.fragment,s),m(K.$$.fragment,s),m(ts.$$.fragment,s),m(as.$$.fragment,s),m(is.$$.fragment,s),m(Ms.$$.fragment,s),m(hs.$$.fragment,s),m(Js.$$.fragment,s),m(us.$$.fragment,s),Ct=!1},d(s){s&&(l(gs),l(ws),l(ds),l(Is),l(Cs),l(U),l(fs),l(g),l(bs),l(d),l($s),l(I),l(As),l(vs),l(f),l(qs),l(b),l(Es),l(Bs),l(A),l(Gs),l(Ns),l(Zs),l(E),l(ks),l(xs),l(G),l(Qs),l(_s),l(Z),l(Ws),l(Xs),l(x),l(Rs),l(Ss),l(_),l(Vs),l(zs),l(X),l(Hs),l(Ls),l(S),l(Fs),l(Ps),l(z),l(Ys),l(Ds),l(L),l(Ks),l(Os),l(P),l(st),l(tt),l(D),l(lt),l(et),l(O),l(at),l(ss),l(nt),l(it),l(ls),l(pt),l(es),l(ot),l(ct),l(ns),l(Mt),l(rt),l(ps),l(ht),l(os),l(mt),l(cs),l(jt),l(yt),l(rs),l(Jt),l(Tt),l(ms),l(ut),l(js),l(wt),l(ys),l(Ut),l(gt),l(Ts),l(dt),l(It),l(Us)),l(T),j(u,s),j(w,s),j(C,s),j($,s),j(v,s),j(q,s),j(B,s),j(N,s),j(k,s),j(Q,s),j(W,s),j(R,s),j(V,s),j(H,s),j(F,s),j(Y,s),j(K,s),j(ts,s),j(as,s),j(is,s),j(Ms,s),j(hs,s),j(Js,s),j(us,s)}}}const yl='{"title":"使用 Elasticsearch 和 Hugging Face 进行语义重排序","local":"使用-elasticsearch-和-hugging-face-进行语义重排序","sections":[{"title":"🧰 必备条件","local":"-必备条件","sections":[],"depth":2},{"title":"安装并导入包","local":"安装并导入包","sections":[],"depth":2},{"title":"初始化 Elasticsearch Python 客户端","local":"初始化-elasticsearch-python-客户端","sections":[],"depth":2},{"title":"测试连接","local":"测试连接","sections":[],"depth":2},{"title":"使用 Eland 上传 Hugging Face 模型","local":"使用-eland-上传-hugging-face-模型","sections":[],"depth":2},{"title":"创建推理端点","local":"创建推理端点","sections":[],"depth":2},{"title":"词汇查询","local":"词汇查询","sections":[{"title":"使用 query_string 查询进行词汇匹配","local":"使用-querystring-查询进行词汇匹配","sections":[],"depth":3},{"title":"简单的 multi_match 查询","local":"简单的-multimatch-查询","sections":[],"depth":3}],"depth":2},{"title":"语义重排序","local":"语义重排序","sections":[],"depth":2},{"title":"了解更多","local":"了解更多","sections":[],"depth":2}],"depth":1}';function Jl(ft){return pl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class gl extends ol{constructor(T){super(),cl(this,T,Jl,jl,nl,{})}}export{gl as component};
