You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _search-plugins/search-relevance/ml-inference-rerank-by-field.md
+14-26Lines changed: 14 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,33 +6,33 @@ grand_parent: Search relevance
6
6
has_children: false
7
7
nav_order: 20
8
8
---
9
-
# ML Inference Processor with By Field Rerank type
9
+
# ML Inference processor with By Field rerank type
10
10
Introduced 2.18
11
11
{: .label .label-purple }
12
12
13
-
You can use the results of a remote model via the [ml_inference]({{site.url}}{{site.baseurl}}/_ingest-pipelines/processors/ml-inference.md) processor, with a [by_field]({{site.url}}{{site.baseurl}}/search-plugins/search-relevance/rerank-by-field/) rerank type to get better search results.
13
+
You can use the results of a ml model using the [ml_inference]({{site.url}}{{site.baseurl}}/_ingest-pipelines/processors/ml-inference.md) processor, with a [by_field]({{site.url}}{{site.baseurl}}/search-plugins/search-relevance/rerank-by-field/) rerank type to get better search results.
14
14
In order to do this you need to configure a search pipeline that runs at search time. The search pipeline will intercept search results
15
15
pass them to the ml_inference processor which will apply a remote cross encoder model. Then once the results are returned it will apply the
16
16
reranker to use that metric in order to rerank your documents.
17
17
18
18
In this tutorial we will showcase a scenario with documents related to New York City areas with emphasis on finding better search results based
19
-
on the provided search query. We will use [Huggingface cross-encoder/ms-marco-MiniLM-L-6-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-6-v2)
19
+
on the provided search query. We will use [HuggingFace cross-encoder/ms-marco-MiniLM-L-6-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-6-v2)
20
20
hosted on Amazon SageMaker.
21
21
22
22
## Running a search with both processors
23
23
24
24
To run a search with reranking, follow these steps:
25
25
26
-
0.[Deploy the model on Amazon SageMaker](#0-deploy-the-model-on-amazon-sagemaker)
26
+
0.[Deploy the model on Amazon SageMaker.](#0-deploy-the-model-on-amazon-sagemaker)
27
27
1.[Create an index for ingestion](#step-1-create-an-index-for-ingestion).
28
28
2.[Create a connector](#step-2-create-a-connector).
29
29
3.[Create a model](#step-3-create-a-model).
30
30
4.[Create the Search pipeline](#step-4-create-the-search-pipeline).
31
31
5.[apply the pipeline on a search query](#step-5-apply-the-pipeline-on-a-search-query).
32
32
33
-
## 0. Deploy the model on Amazon Sagemaker
34
-
Use the following code to deploy the model on Amazon Sagemaker.
35
-
You can find all supported instance type and price on [Amazon Sagemaker Pricing document](https://aws.amazon.com/sagemaker/pricing/). Suggest to use GPU for better performance.
33
+
## 0. Deploy the model on Amazon SageMaker
34
+
Use the following code to deploy the model on Amazon SageMaker.
35
+
You can find all supported instance type and price on [Amazon SageMaker Pricing document](https://aws.amazon.com/sagemaker/pricing/). Suggest to use GPU for better performance.
To find the endpoint make sure to the SageMaker homepage and navigate in the left tab **Inference > Endpoints** make note of the url specific to the model created it will be used when creating the connector.
61
61
62
-
## Step 1: Create an Index for Ingestion
62
+
## Step 1: Create an index for ingestion
63
63
Create an index called nyc_areas
64
64
```json
65
65
POST /nyc_areas/_bulk
@@ -80,13 +80,13 @@ POST /nyc_areas/_bulk
80
80
{% include copy-curl.html %}
81
81
82
82
## Step 2: Create a connector
83
-
Create a conector assuming you have created a sagemaker model with a cross encoder
83
+
Create a connector assuming you have created a SageMaker model with a cross encoder
84
84
85
85
```json
86
86
POST /_plugins/_ml/connectors/_create
87
87
{
88
88
"name": "SageMaker cross-encoder model",
89
-
"description": "Test connector for Sagemaker cross-encoder model",
89
+
"description": "Test connector for SageMaker cross-encoder hosted model",
90
90
"version": 1,
91
91
"protocol": "aws_sigv4",
92
92
"credential": {
@@ -95,7 +95,7 @@ POST /_plugins/_ml/connectors/_create
95
95
"session_token": "<Session token>"
96
96
},
97
97
"parameters": {
98
-
"region": "us-east-1",
98
+
"region": "<region>",
99
99
"service_name": "sagemaker"
100
100
},
101
101
"actions": [
@@ -106,18 +106,7 @@ POST /_plugins/_ml/connectors/_create
0 commit comments