|
| 1 | +[[ml-nlp-e5]] |
| 2 | += E5 – EmbEddings from bidirEctional Encoder rEpresentations |
| 3 | +++++ |
| 4 | +<titleabbrev>E5</titleabbrev> |
| 5 | +++++ |
| 6 | + |
| 7 | +:frontmatter-description: E5 is a multilingual dense vector model. |
| 8 | +:frontmatter-tags-products: [ml] |
| 9 | +:frontmatter-tags-content-type: [how-to] |
| 10 | +:frontmatter-tags-user-goals: [analyze] |
| 11 | + |
| 12 | +EmbEddings from bidirEctional Encoder rEpresentations - or E5 - is a {nlp} |
| 13 | +model that enables you to perform multi-lingual semantic search by using dense |
| 14 | +vector representations. This model is recommended for non-English language |
| 15 | +documents and queries. If you want to perform semantic search on English |
| 16 | +language documents, use the <<ml-nlp-elser>> model. |
| 17 | + |
| 18 | +{ref}/semantic-search.html[Semantic search] provides you search results based on |
| 19 | +contextual meaning and user intent, rather than exact keyword matches. |
| 20 | + |
| 21 | +E5 has two versions: one cross-platform version which runs on any hardware |
| 22 | +and one version which is optimized for Intel® silicon. The |
| 23 | +**Model Management** > **Trained Models** page shows you which version of E5 is |
| 24 | +recommended to deploy based on your cluster's hardware. |
| 25 | + |
| 26 | +The supported model version of E5 is `multilingual-e5-small`, refer to |
| 27 | +<<ml-nlp-e5-limit, this page>> for more information. |
| 28 | + |
| 29 | +Refer to the model cards of the |
| 30 | +https://huggingface.co/elastic/multilingual-e5-small[multilingual-e5-small] and |
| 31 | +the |
| 32 | +https://huggingface.co/elastic/multilingual-e5-small-optimized[multilingual-e5-small-optimized] |
| 33 | +models on HuggingFace for further information including licensing. |
| 34 | + |
| 35 | + |
| 36 | +[discrete] |
| 37 | +[[e5-req]] |
| 38 | +== Requirements |
| 39 | + |
| 40 | +To use E5, you must have the {subscriptions}[appropriate subscription] level |
| 41 | +for semantic search or the trial period activated. |
| 42 | + |
| 43 | + |
| 44 | +[discrete] |
| 45 | +[[download-deploy-e5]] |
| 46 | +== Download and deploy E5 |
| 47 | + |
| 48 | +You can download and deploy the E5 model either from |
| 49 | +**{ml-app}** > **Trained Models**, from **Search** > **Indices**, or by using |
| 50 | +the Dev Console. |
| 51 | + |
| 52 | + |
| 53 | +[discrete] |
| 54 | +[[trained-model-e5]] |
| 55 | +=== Using the Trained Models page |
| 56 | + |
| 57 | +1. In {kib}, navigate to **{ml-app}** > **Trained Models**. E5 can be found in |
| 58 | +the list of trained models. There are two versions available: one portable |
| 59 | +version which runs on any hardware and one version which is optimized for Intel® |
| 60 | +silicon. You can see which model is recommended to use based on your hardware |
| 61 | +configuration. |
| 62 | +2. Click the **Add trained model** button. Select the E5 model version you want |
| 63 | +to use in the opening modal window. The model that is recommended for you based |
| 64 | +on your hardware configuration is highlighted. Click **Download**. You can check |
| 65 | +the download status on the **Notifications** page. |
| 66 | ++ |
| 67 | +-- |
| 68 | +[role="screenshot"] |
| 69 | +image::images/ml-nlp-e5-download.png[alt="Downloading E5",align="center"] |
| 70 | +-- |
| 71 | ++ |
| 72 | +-- |
| 73 | +Alternatively, click the **Download model** button under **Actions** in the |
| 74 | +trained model list. |
| 75 | +-- |
| 76 | +3. After the download is finished, start the deployment by clicking the |
| 77 | +**Start deployment** button. |
| 78 | +4. Provide a deployment ID, select the priority, and set the number of |
| 79 | +allocations and threads per allocation values. |
| 80 | ++ |
| 81 | +-- |
| 82 | +[role="screenshot"] |
| 83 | +image::images/ml-nlp-deployment-id-e5.png[alt="Deploying ELSER",align="center"] |
| 84 | +-- |
| 85 | +5. Click Start. |
| 86 | + |
| 87 | + |
| 88 | +[discrete] |
| 89 | +[[elasticsearch-e5]] |
| 90 | +=== Using the search indices UI |
| 91 | + |
| 92 | +Alternatively, you can download and deploy the E5 model to an {infer} pipeline |
| 93 | +using the search indices UI. |
| 94 | + |
| 95 | +1. In {kib}, navigate to **Search** > **Indices**. |
| 96 | +2. Select the index from the list that has an {infer} pipeline in which you want |
| 97 | +to use E5. |
| 98 | +3. Navigate to the **Pipelines** tab. |
| 99 | +4. Under **{ml-app} {infer-cap} Pipelines**, click the **Deploy** button in the |
| 100 | +**Improve your results with E5** section to begin downloading the E5 model. This |
| 101 | +may take a few minutes depending on your network. |
| 102 | ++ |
| 103 | +-- |
| 104 | +[role="screenshot"] |
| 105 | +image::images/ml-nlp-deploy-e5-es.png[alt="Deploying E5 in Elasticsearch",align="center"] |
| 106 | +-- |
| 107 | +5. Once the model is downloaded, click the **Start single-threaded** button to |
| 108 | +start the model with basic configuration or select the **Fine-tune performance** |
| 109 | +option to navigate to the **Trained Models** page where you can configure the |
| 110 | +model deployment. |
| 111 | ++ |
| 112 | +-- |
| 113 | +[role="screenshot"] |
| 114 | +image::images/ml-nlp-start-e5-es.png[alt="Start E5 in Elasticsearch",align="center"] |
| 115 | +-- |
| 116 | + |
| 117 | +When your E5 model is deployed and started, it is ready to be used in a |
| 118 | +pipeline. |
| 119 | + |
| 120 | + |
| 121 | +[discrete] |
| 122 | +[[dev-console-e5]] |
| 123 | +=== Using the Dev Console |
| 124 | + |
| 125 | +1. In {kib}, navigate to the **Dev Console**. |
| 126 | +2. Create the E5 model configuration by running the following API call: |
| 127 | ++ |
| 128 | +-- |
| 129 | +[source,console] |
| 130 | +---------------------------------- |
| 131 | +PUT _ml/trained_models/.multilingual-e5-small |
| 132 | +{ |
| 133 | + "input": { |
| 134 | + "field_names": ["text_field"] |
| 135 | + } |
| 136 | +} |
| 137 | +---------------------------------- |
| 138 | + |
| 139 | +The API call automatically initiates the model download if the model is not |
| 140 | +downloaded yet. |
| 141 | +-- |
| 142 | +3. Deploy the model by using the |
| 143 | +{ref}/start-trained-model-deployment.html[start trained model deployment API] |
| 144 | +with a delpoyment ID: |
| 145 | ++ |
| 146 | +-- |
| 147 | +[source,console] |
| 148 | +---------------------------------- |
| 149 | +POST _ml/trained_models/.multilingual-e5-small/deployment/_start?deployment_id=for_search |
| 150 | +---------------------------------- |
| 151 | +-- |
| 152 | + |
| 153 | +[discrete] |
| 154 | +[[air-gapped-install-e5]] |
| 155 | +== Deploy the E5 model in an air-gapped environment |
| 156 | + |
| 157 | +If you want to deploy the E5 model in a restricted or closed network, follow the |
| 158 | +instructions |
| 159 | +https://www.elastic.co/guide/en/elasticsearch/client/eland/current/machine-learning.html#ml-nlp-pytorch-air-gapped[in the Eland client documentation]. |
0 commit comments