import{s as pl,n as Ml,o as ol}from"../chunks/scheduler.1f027d5a.js";import{S as cl,i as Jl,e as i,s as a,c as o,h as Tl,a as p,d as l,b as n,f as nl,g as c,j as M,k as il,l as rl,m as e,n as J,t as T,o as r,p as m}from"../chunks/index.6117a65d.js";import{C as ml}from"../chunks/CopyLLMTxtMenu.610b106b.js";import{D as jl,C as y}from"../chunks/DocNotebookDropdown.4ae0d470.js";import{H as j,E as yl}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.bd18ae98.js";function hl(At){let h,gs,Is,Cs,w,ds,u,fs,I,bs,U,$t='<em>作者：<a href="https://github.com/leemthompo" rel="nofollow">Liam Thompson</a></em>',As,g,vt="在本 Notebook 中，我们将学习如何通过将 Hugging Face 中的模型上传到 Elasticsearch 集群来实现语义重排序。我们将使用 <code>retriever</code> 抽象，它是一个简化的 Elasticsearch 查询语法，便于构建查询并结合不同的搜索操作。",$s,C,qt="你将会：",vs,d,Bt='<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>',qs,f,Bs,b,Et="为了运行此示例，你需要：",Es,A,Gt='<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>',Gs,$,Ns,v,Nt="ℹ️ <code>eland</code> 的安装可能需要几分钟时间。",Zs,q,xs,B,ks,E,Zt="首先，你需要连接到你的 Elasticsearch 实例。",Qs,G,_s,N,xt=`Elastic Cloud ID: ··········
Elastic Api Key: ··········
`,Ws,Z,Ss,x,kt="通过以下测试确认 Python 客户端是否已成功连接到你的 Elasticsearch 实例。",Xs,k,Rs,Q,Qt="这个示例使用了一个小型的电影数据集。",Vs,_,zs,W,_t="Done indexing documents into `movies` index!\n",Ls,S,Hs,X,Wt="现在，我们将使用 Eland 的 <code>eland_import_hub_model</code> 命令将模型上传到 Elasticsearch。在这个示例中，我们选择了 <code>cross-encoder/ms-marco-MiniLM-L-6-v2</code> 文本相似度模型。",Fs,R,Ps,V,St=`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'
`,Ys,z,Ds,L,Xt="接下来，我们将为 <code>rerank</code> 任务创建一个推理端点，以部署和管理我们的模型，并在需要时启动必要的机器学习资源。",Ks,H,Os,F,Rt="运行以下命令以确认你的推理端点已成功部署。",st,P,tt,Y,Vt=`⚠️ 当你部署模型时，可能需要在 Kibana（或无服务器）UI 中同步你的机器学习保存对象。<br/>
请前往 <strong>训练模型</strong> 并选择 <strong>同步保存对象</strong>。`,lt,D,et,K,zt="首先，让我们使用一个 <code>standard</code> 检索器来测试一些词汇（或全文）搜索，然后我们将比较在加入语义重排序后所带来的改进。",at,O,nt,ss,Lt="假设我们模糊记得有一部关于吃人肉的杀手的著名电影。为了论证，假设我们暂时忘记了“食人者”这个词。",it,ts,Ht='让我们执行一个 <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”。',pt,ls,Mt,es,Ft=`No search results found
`,ot,as,Pt="没有结果！不幸的是，我们没有找到与 “flesh-eating bad guy” 精确匹配的结果。由于我们没有关于 Elasticsearch 数据中确切措辞的更多信息，我们需要扩大搜索范围。",ct,ns,Jt,is,Yt="这个词汇查询在我们的 Elasticsearch 文档的 <code>plot</code> 和 <code>genre</code> 字段中执行了一个标准的关键词搜索，查找术语 “crime”。",Tt,ps,rt,Ms,Dt=`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.
`,mt,os,Kt="好多了！至少现在我们有了一些结果。我们扩大了搜索标准，以提高找到相关结果的机会。",jt,cs,Ot="不过，这些结果在我们原始查询 “flesh-eating bad guy” 的语境下并不是很精确。我们可以看到，“沉默的羔羊”出现在结果列表的中间，这是一个使用了通用 <code>match</code> 查询的结果。让我们看看是否可以使用我们的语义重排序模型，来更接近搜索者的原始意图。",yt,Js,ht,Ts,sl="在以下的 <code>retriever</code> 语法中，我们将标准查询检索器包装在一个 <code>text_similarity_reranker</code> 中。这样，我们就可以利用我们部署到 Elasticsearch 的 NLP 模型，根据短语 “flesh-eating bad guy” 对结果进行重排序。",wt,rs,ut,ms,tl=`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.
`,It,js,ll="成功了！“沉默的羔羊”是我们的首个结果。语义重排序通过解析自然语言查询，帮助我们找到最相关的结果，克服了依赖精确匹配的词汇搜索的局限性。",Ut,ys,el="语义重排序通过几个步骤实现了语义搜索，而无需生成和存储嵌入。能够在 Elasticsearch 集群中本地使用托管在 Hugging Face 上的开源模型，非常适合原型开发、测试和构建搜索体验。",gt,hs,Ct,ws,al='<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,ft,Us,bt;return w=new jl({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"}]}}),u=new ml({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),I=new j({props:{title:"使用 Elasticsearch 和 Hugging Face 进行语义重排序",local:"使用-elasticsearch-和-hugging-face-进行语义重排序",headingTag:"h1"}}),f=new j({props:{title:"🧰 必备条件",local:"-必备条件",headingTag:"h2"}}),$=new j({props:{title:"安装并导入包",local:"安装并导入包",headingTag:"h2"}}),q=new y({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}}),B=new j({props:{title:"初始化 Elasticsearch Python 客户端",local:"初始化-elasticsearch-python-客户端",headingTag:"h2"}}),G=new y({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}}),Z=new j({props:{title:"测试连接",local:"测试连接",headingTag:"h2"}}),k=new y({props:{code:"cHJpbnQoY2xpZW50LmluZm8oKSk=",highlighted:'<span class="hljs-built_in">print</span>(client.info())',wrap:!1}}),_=new y({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}}),S=new j({props:{title:"使用 Eland 上传 Hugging Face 模型",local:"使用-eland-上传-hugging-face-模型",headingTag:"h2"}}),R=new y({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}}),z=new j({props:{title:"创建推理端点",local:"创建推理端点",headingTag:"h2"}}),H=new y({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}}),P=new y({props:{code:"Y2xpZW50LmluZmVyZW5jZS5nZXQoKQ==",highlighted:"client.inference.get()",wrap:!1}}),D=new j({props:{title:"词汇查询",local:"词汇查询",headingTag:"h2"}}),O=new j({props:{title:"使用 query_string 查询进行词汇匹配",local:"使用-querystring-查询进行词汇匹配",headingTag:"h3"}}),ls=new y({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}}),ns=new j({props:{title:"简单的 multi_match 查询",local:"简单的-multimatch-查询",headingTag:"h3"}}),ps=new y({props:{code:"cmVzcCUyMCUzRCUyMGNsaWVudC5zZWFyY2goJTBBJTIwJTIwJTIwJTIwaW5kZXglM0QlMjJtb3ZpZXMlMjIlMkMlMEElMjAlMjAlMjAlMjByZXRyaWV2ZXIlM0QlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJzdGFuZGFyZCUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnF1ZXJ5JTIyJTNBJTIwJTdCJTIybXVsdGlfbWF0Y2glMjIlM0ElMjAlN0IlMjJxdWVyeSUyMiUzQSUyMCUyMmNyaW1lJTIyJTJDJTIwJTIyZmllbGRzJTIyJTNBJTIwJTVCJTIycGxvdCUyMiUyQyUyMCUyMmdlbnJlJTIyJTVEJTdEJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBKSUwQSUwQWZvciUyMGhpdCUyMGluJTIwcmVzcCU1QiUyMmhpdHMlMjIlNUQlNUIlMjJoaXRzJTIyJTVEJTNBJTBBJTIwJTIwJTIwJTIwdGl0bGUlMjAlM0QlMjBoaXQlNUIlMjJfc291cmNlJTIyJTVEJTVCJTIydGl0bGUlMjIlNUQlMEElMjAlMjAlMjAlMjBwbG90JTIwJTNEJTIwaGl0JTVCJTIyX3NvdXJjZSUyMiU1RCU1QiUyMnBsb3QlMjIlNUQlMEElMjAlMjAlMjAlMjBwcmludChmJTIyVGl0bGUlM0ElMjAlN0J0aXRsZSU3RCU1Q25QbG90JTNBJTIwJTdCcGxvdCU3RCU1Q24lMjIp",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-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">... </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 j({props:{title:"语义重排序",local:"语义重排序",headingTag:"h2"}}),rs=new y({props:{code:"cmVzcCUyMCUzRCUyMGNsaWVudC5zZWFyY2goJTBBJTIwJTIwJTIwJTIwaW5kZXglM0QlMjJtb3ZpZXMlMjIlMkMlMEElMjAlMjAlMjAlMjByZXRyaWV2ZXIlM0QlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ0ZXh0X3NpbWlsYXJpdHlfcmVyYW5rZXIlMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyZXRyaWV2ZXIlMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJzdGFuZGFyZCUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnF1ZXJ5JTIyJTNBJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIybXVsdGlfbWF0Y2glMjIlM0ElMjAlN0IlMjJxdWVyeSUyMiUzQSUyMCUyMmNyaW1lJTIyJTJDJTIwJTIyZmllbGRzJTIyJTNBJTIwJTVCJTIycGxvdCUyMiUyQyUyMCUyMmdlbnJlJTIyJTVEJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyZmllbGQlMjIlM0ElMjAlMjJwbG90JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyaW5mZXJlbmNlX2lkJTIyJTNBJTIwJTIybXktbXNtYXJjby1taW5pbG0tbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJpbmZlcmVuY2VfdGV4dCUyMiUzQSUyMCUyMmZsZXNoLWVhdGluZyUyMGJhZCUyMGd1eSUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSklMEElMEFmb3IlMjBoaXQlMjBpbiUyMHJlc3AlNUIlMjJoaXRzJTIyJTVEJTVCJTIyaGl0cyUyMiU1RCUzQSUwQSUyMCUyMCUyMCUyMHRpdGxlJTIwJTNEJTIwaGl0JTVCJTIyX3NvdXJjZSUyMiU1RCU1QiUyMnRpdGxlJTIyJTVEJTBBJTIwJTIwJTIwJTIwcGxvdCUyMCUzRCUyMGhpdCU1QiUyMl9zb3VyY2UlMjIlNUQlNUIlMjJwbG90JTIyJTVEJTBBJTIwJTIwJTIwJTIwcHJpbnQoZiUyMlRpdGxlJTNBJTIwJTdCdGl0bGUlN0QlNUNuUGxvdCUzQSUyMCU3QnBsb3QlN0QlNUNuJTIyKQ==",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-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;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">... </span>                }
<span class="hljs-meta">... </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}}),hs=new j({props:{title:"了解更多",local:"了解更多",headingTag:"h2"}}),us=new yl({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/zh-CN/semantic_reranking_elasticsearch.md"}}),{c(){h=i("meta"),gs=a(),Is=i("p"),Cs=a(),o(w.$$.fragment),ds=a(),o(u.$$.fragment),fs=a(),o(I.$$.fragment),bs=a(),U=i("p"),U.innerHTML=$t,As=a(),g=i("p"),g.innerHTML=vt,$s=a(),C=i("p"),C.textContent=qt,vs=a(),d=i("ul"),d.innerHTML=Bt,qs=a(),o(f.$$.fragment),Bs=a(),b=i("p"),b.textContent=Et,Es=a(),A=i("ul"),A.innerHTML=Gt,Gs=a(),o($.$$.fragment),Ns=a(),v=i("p"),v.innerHTML=Nt,Zs=a(),o(q.$$.fragment),xs=a(),o(B.$$.fragment),ks=a(),E=i("p"),E.textContent=Zt,Qs=a(),o(G.$$.fragment),_s=a(),N=i("pre"),N.textContent=xt,Ws=a(),o(Z.$$.fragment),Ss=a(),x=i("p"),x.textContent=kt,Xs=a(),o(k.$$.fragment),Rs=a(),Q=i("p"),Q.textContent=Qt,Vs=a(),o(_.$$.fragment),zs=a(),W=i("pre"),W.textContent=_t,Ls=a(),o(S.$$.fragment),Hs=a(),X=i("p"),X.innerHTML=Wt,Fs=a(),o(R.$$.fragment),Ps=a(),V=i("pre"),V.textContent=St,Ys=a(),o(z.$$.fragment),Ds=a(),L=i("p"),L.innerHTML=Xt,Ks=a(),o(H.$$.fragment),Os=a(),F=i("p"),F.textContent=Rt,st=a(),o(P.$$.fragment),tt=a(),Y=i("p"),Y.innerHTML=Vt,lt=a(),o(D.$$.fragment),et=a(),K=i("p"),K.innerHTML=zt,at=a(),o(O.$$.fragment),nt=a(),ss=i("p"),ss.textContent=Lt,it=a(),ts=i("p"),ts.innerHTML=Ht,pt=a(),o(ls.$$.fragment),Mt=a(),es=i("pre"),es.textContent=Ft,ot=a(),as=i("p"),as.textContent=Pt,ct=a(),o(ns.$$.fragment),Jt=a(),is=i("p"),is.innerHTML=Yt,Tt=a(),o(ps.$$.fragment),rt=a(),Ms=i("pre"),Ms.textContent=Dt,mt=a(),os=i("p"),os.textContent=Kt,jt=a(),cs=i("p"),cs.innerHTML=Ot,yt=a(),o(Js.$$.fragment),ht=a(),Ts=i("p"),Ts.innerHTML=sl,wt=a(),o(rs.$$.fragment),ut=a(),ms=i("pre"),ms.textContent=tl,It=a(),js=i("p"),js.textContent=ll,Ut=a(),ys=i("p"),ys.textContent=el,gt=a(),o(hs.$$.fragment),Ct=a(),ws=i("ul"),ws.innerHTML=al,dt=a(),o(us.$$.fragment),ft=a(),Us=i("p"),this.h()},l(s){const t=Tl("svelte-u9bgzb",document.head);h=p(t,"META",{name:!0,content:!0}),t.forEach(l),gs=n(s),Is=p(s,"P",{}),nl(Is).forEach(l),Cs=n(s),c(w.$$.fragment,s),ds=n(s),c(u.$$.fragment,s),fs=n(s),c(I.$$.fragment,s),bs=n(s),U=p(s,"P",{"data-svelte-h":!0}),M(U)!=="svelte-cq4nha"&&(U.innerHTML=$t),As=n(s),g=p(s,"P",{"data-svelte-h":!0}),M(g)!=="svelte-1ckcjxc"&&(g.innerHTML=vt),$s=n(s),C=p(s,"P",{"data-svelte-h":!0}),M(C)!=="svelte-pjmzo6"&&(C.textContent=qt),vs=n(s),d=p(s,"UL",{"data-svelte-h":!0}),M(d)!=="svelte-17y1h9w"&&(d.innerHTML=Bt),qs=n(s),c(f.$$.fragment,s),Bs=n(s),b=p(s,"P",{"data-svelte-h":!0}),M(b)!=="svelte-1aj4rwe"&&(b.textContent=Et),Es=n(s),A=p(s,"UL",{"data-svelte-h":!0}),M(A)!=="svelte-g1ku20"&&(A.innerHTML=Gt),Gs=n(s),c($.$$.fragment,s),Ns=n(s),v=p(s,"P",{"data-svelte-h":!0}),M(v)!=="svelte-hw95n9"&&(v.innerHTML=Nt),Zs=n(s),c(q.$$.fragment,s),xs=n(s),c(B.$$.fragment,s),ks=n(s),E=p(s,"P",{"data-svelte-h":!0}),M(E)!=="svelte-1gzwu60"&&(E.textContent=Zt),Qs=n(s),c(G.$$.fragment,s),_s=n(s),N=p(s,"PRE",{"data-svelte-h":!0}),M(N)!=="svelte-1x47hmf"&&(N.textContent=xt),Ws=n(s),c(Z.$$.fragment,s),Ss=n(s),x=p(s,"P",{"data-svelte-h":!0}),M(x)!=="svelte-gj2uvi"&&(x.textContent=kt),Xs=n(s),c(k.$$.fragment,s),Rs=n(s),Q=p(s,"P",{"data-svelte-h":!0}),M(Q)!=="svelte-16uiuvb"&&(Q.textContent=Qt),Vs=n(s),c(_.$$.fragment,s),zs=n(s),W=p(s,"PRE",{"data-svelte-h":!0}),M(W)!=="svelte-1m77zdm"&&(W.textContent=_t),Ls=n(s),c(S.$$.fragment,s),Hs=n(s),X=p(s,"P",{"data-svelte-h":!0}),M(X)!=="svelte-nbuvli"&&(X.innerHTML=Wt),Fs=n(s),c(R.$$.fragment,s),Ps=n(s),V=p(s,"PRE",{"data-svelte-h":!0}),M(V)!=="svelte-1o6q6qn"&&(V.textContent=St),Ys=n(s),c(z.$$.fragment,s),Ds=n(s),L=p(s,"P",{"data-svelte-h":!0}),M(L)!=="svelte-1g9m4gs"&&(L.innerHTML=Xt),Ks=n(s),c(H.$$.fragment,s),Os=n(s),F=p(s,"P",{"data-svelte-h":!0}),M(F)!=="svelte-1gtbyax"&&(F.textContent=Rt),st=n(s),c(P.$$.fragment,s),tt=n(s),Y=p(s,"P",{"data-svelte-h":!0}),M(Y)!=="svelte-ybmt89"&&(Y.innerHTML=Vt),lt=n(s),c(D.$$.fragment,s),et=n(s),K=p(s,"P",{"data-svelte-h":!0}),M(K)!=="svelte-1iwnfi3"&&(K.innerHTML=zt),at=n(s),c(O.$$.fragment,s),nt=n(s),ss=p(s,"P",{"data-svelte-h":!0}),M(ss)!=="svelte-jpohc3"&&(ss.textContent=Lt),it=n(s),ts=p(s,"P",{"data-svelte-h":!0}),M(ts)!=="svelte-sqojhj"&&(ts.innerHTML=Ht),pt=n(s),c(ls.$$.fragment,s),Mt=n(s),es=p(s,"PRE",{"data-svelte-h":!0}),M(es)!=="svelte-k5qxm1"&&(es.textContent=Ft),ot=n(s),as=p(s,"P",{"data-svelte-h":!0}),M(as)!=="svelte-1fn7x3h"&&(as.textContent=Pt),ct=n(s),c(ns.$$.fragment,s),Jt=n(s),is=p(s,"P",{"data-svelte-h":!0}),M(is)!=="svelte-15tuuzt"&&(is.innerHTML=Yt),Tt=n(s),c(ps.$$.fragment,s),rt=n(s),Ms=p(s,"PRE",{"data-svelte-h":!0}),M(Ms)!=="svelte-t0ny4t"&&(Ms.textContent=Dt),mt=n(s),os=p(s,"P",{"data-svelte-h":!0}),M(os)!=="svelte-456bk1"&&(os.textContent=Kt),jt=n(s),cs=p(s,"P",{"data-svelte-h":!0}),M(cs)!=="svelte-xx2jb6"&&(cs.innerHTML=Ot),yt=n(s),c(Js.$$.fragment,s),ht=n(s),Ts=p(s,"P",{"data-svelte-h":!0}),M(Ts)!=="svelte-yqfmn6"&&(Ts.innerHTML=sl),wt=n(s),c(rs.$$.fragment,s),ut=n(s),ms=p(s,"PRE",{"data-svelte-h":!0}),M(ms)!=="svelte-vpj64j"&&(ms.textContent=tl),It=n(s),js=p(s,"P",{"data-svelte-h":!0}),M(js)!=="svelte-1jkxv1r"&&(js.textContent=ll),Ut=n(s),ys=p(s,"P",{"data-svelte-h":!0}),M(ys)!=="svelte-o8g29r"&&(ys.textContent=el),gt=n(s),c(hs.$$.fragment,s),Ct=n(s),ws=p(s,"UL",{"data-svelte-h":!0}),M(ws)!=="svelte-dg281i"&&(ws.innerHTML=al),dt=n(s),c(us.$$.fragment,s),ft=n(s),Us=p(s,"P",{}),nl(Us).forEach(l),this.h()},h(){il(h,"name","hf:doc:metadata"),il(h,"content",wl)},m(s,t){rl(document.head,h),e(s,gs,t),e(s,Is,t),e(s,Cs,t),J(w,s,t),e(s,ds,t),J(u,s,t),e(s,fs,t),J(I,s,t),e(s,bs,t),e(s,U,t),e(s,As,t),e(s,g,t),e(s,$s,t),e(s,C,t),e(s,vs,t),e(s,d,t),e(s,qs,t),J(f,s,t),e(s,Bs,t),e(s,b,t),e(s,Es,t),e(s,A,t),e(s,Gs,t),J($,s,t),e(s,Ns,t),e(s,v,t),e(s,Zs,t),J(q,s,t),e(s,xs,t),J(B,s,t),e(s,ks,t),e(s,E,t),e(s,Qs,t),J(G,s,t),e(s,_s,t),e(s,N,t),e(s,Ws,t),J(Z,s,t),e(s,Ss,t),e(s,x,t),e(s,Xs,t),J(k,s,t),e(s,Rs,t),e(s,Q,t),e(s,Vs,t),J(_,s,t),e(s,zs,t),e(s,W,t),e(s,Ls,t),J(S,s,t),e(s,Hs,t),e(s,X,t),e(s,Fs,t),J(R,s,t),e(s,Ps,t),e(s,V,t),e(s,Ys,t),J(z,s,t),e(s,Ds,t),e(s,L,t),e(s,Ks,t),J(H,s,t),e(s,Os,t),e(s,F,t),e(s,st,t),J(P,s,t),e(s,tt,t),e(s,Y,t),e(s,lt,t),J(D,s,t),e(s,et,t),e(s,K,t),e(s,at,t),J(O,s,t),e(s,nt,t),e(s,ss,t),e(s,it,t),e(s,ts,t),e(s,pt,t),J(ls,s,t),e(s,Mt,t),e(s,es,t),e(s,ot,t),e(s,as,t),e(s,ct,t),J(ns,s,t),e(s,Jt,t),e(s,is,t),e(s,Tt,t),J(ps,s,t),e(s,rt,t),e(s,Ms,t),e(s,mt,t),e(s,os,t),e(s,jt,t),e(s,cs,t),e(s,yt,t),J(Js,s,t),e(s,ht,t),e(s,Ts,t),e(s,wt,t),J(rs,s,t),e(s,ut,t),e(s,ms,t),e(s,It,t),e(s,js,t),e(s,Ut,t),e(s,ys,t),e(s,gt,t),J(hs,s,t),e(s,Ct,t),e(s,ws,t),e(s,dt,t),J(us,s,t),e(s,ft,t),e(s,Us,t),bt=!0},p:Ml,i(s){bt||(T(w.$$.fragment,s),T(u.$$.fragment,s),T(I.$$.fragment,s),T(f.$$.fragment,s),T($.$$.fragment,s),T(q.$$.fragment,s),T(B.$$.fragment,s),T(G.$$.fragment,s),T(Z.$$.fragment,s),T(k.$$.fragment,s),T(_.$$.fragment,s),T(S.$$.fragment,s),T(R.$$.fragment,s),T(z.$$.fragment,s),T(H.$$.fragment,s),T(P.$$.fragment,s),T(D.$$.fragment,s),T(O.$$.fragment,s),T(ls.$$.fragment,s),T(ns.$$.fragment,s),T(ps.$$.fragment,s),T(Js.$$.fragment,s),T(rs.$$.fragment,s),T(hs.$$.fragment,s),T(us.$$.fragment,s),bt=!0)},o(s){r(w.$$.fragment,s),r(u.$$.fragment,s),r(I.$$.fragment,s),r(f.$$.fragment,s),r($.$$.fragment,s),r(q.$$.fragment,s),r(B.$$.fragment,s),r(G.$$.fragment,s),r(Z.$$.fragment,s),r(k.$$.fragment,s),r(_.$$.fragment,s),r(S.$$.fragment,s),r(R.$$.fragment,s),r(z.$$.fragment,s),r(H.$$.fragment,s),r(P.$$.fragment,s),r(D.$$.fragment,s),r(O.$$.fragment,s),r(ls.$$.fragment,s),r(ns.$$.fragment,s),r(ps.$$.fragment,s),r(Js.$$.fragment,s),r(rs.$$.fragment,s),r(hs.$$.fragment,s),r(us.$$.fragment,s),bt=!1},d(s){s&&(l(gs),l(Is),l(Cs),l(ds),l(fs),l(bs),l(U),l(As),l(g),l($s),l(C),l(vs),l(d),l(qs),l(Bs),l(b),l(Es),l(A),l(Gs),l(Ns),l(v),l(Zs),l(xs),l(ks),l(E),l(Qs),l(_s),l(N),l(Ws),l(Ss),l(x),l(Xs),l(Rs),l(Q),l(Vs),l(zs),l(W),l(Ls),l(Hs),l(X),l(Fs),l(Ps),l(V),l(Ys),l(Ds),l(L),l(Ks),l(Os),l(F),l(st),l(tt),l(Y),l(lt),l(et),l(K),l(at),l(nt),l(ss),l(it),l(ts),l(pt),l(Mt),l(es),l(ot),l(as),l(ct),l(Jt),l(is),l(Tt),l(rt),l(Ms),l(mt),l(os),l(jt),l(cs),l(yt),l(ht),l(Ts),l(wt),l(ut),l(ms),l(It),l(js),l(Ut),l(ys),l(gt),l(Ct),l(ws),l(dt),l(ft),l(Us)),l(h),m(w,s),m(u,s),m(I,s),m(f,s),m($,s),m(q,s),m(B,s),m(G,s),m(Z,s),m(k,s),m(_,s),m(S,s),m(R,s),m(z,s),m(H,s),m(P,s),m(D,s),m(O,s),m(ls,s),m(ns,s),m(ps,s),m(Js,s),m(rs,s),m(hs,s),m(us,s)}}}const wl='{"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 ul(At){return ol(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fl extends cl{constructor(h){super(),Jl(this,h,ul,hl,pl,{})}}export{fl as component};
