From 25a0602030e4b25193886da93b0a0656b6f5655d Mon Sep 17 00:00:00 2001 From: David Kyle Date: Wed, 4 Dec 2024 15:43:22 +0000 Subject: [PATCH 1/2] Use elasticsearch service --- .../search-your-data/semantic-text-hybrid-search | 12 ++++++------ .../inference-api/infer-api-task.asciidoc | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/reference/search/search-your-data/semantic-text-hybrid-search b/docs/reference/search/search-your-data/semantic-text-hybrid-search index c56b283434df5..adf8b8489a480 100644 --- a/docs/reference/search/search-your-data/semantic-text-hybrid-search +++ b/docs/reference/search/search-your-data/semantic-text-hybrid-search @@ -20,7 +20,7 @@ Create an inference endpoint by using the <>: ------------------------------------------------------------ PUT _inference/sparse_embedding/my-elser-endpoint <1> { - "service": "elser", <2> + "service": "elasticsearch", <2> "service_settings": { "adaptive_allocations": { <3> "enabled": true, @@ -35,7 +35,7 @@ PUT _inference/sparse_embedding/my-elser-endpoint <1> <1> The task type is `sparse_embedding` in the path as the `elser` service will be used and ELSER creates sparse vectors. The `inference_id` is `my-elser-endpoint`. -<2> The `elser` service is used in this example. +<2> The `elasticsearch` service is used in this example. <3> This setting enables and configures adaptive allocations. Adaptive allocations make it possible for ELSER to automatically scale up or down resources based on the current load on the process. @@ -59,7 +59,7 @@ PUT semantic-embeddings "mappings": { "properties": { "semantic_text": { <1> - "type": "semantic_text", + "type": "semantic_text", "inference_id": "my-elser-endpoint" <2> }, "content": { <3> @@ -99,7 +99,7 @@ Download the file and upload it to your cluster using the {kibana-ref}/connect-t ==== Reindex the data for hybrid search Reindex the data from the `test-data` index into the `semantic-embeddings` index. -The data in the `content` field of the source index is copied into the `content` field of the destination index. +The data in the `content` field of the source index is copied into the `content` field of the destination index. The `copy_to` parameter set in the index mapping creation ensures that the content is copied into the `semantic_text` field. The data is processed by the {infer} endpoint at ingest time to generate embeddings. [NOTE] @@ -211,7 +211,7 @@ After performing the hybrid search, the query will return the top 10 documents t "hits": [ { "_index": "semantic-embeddings", - "_id": "wv65epIBEMBRnhfTsOFM", + "_id": "wv65epIBEMBRnhfTsOFM", "_score": 0.032786883, "_rank": 1, "_source": { @@ -237,7 +237,7 @@ After performing the hybrid search, the query will return the top 10 documents t "out": 1.0991782, "##io": 1.0794281, "last": 1.0474665, - (...) + (...) } } ] diff --git a/docs/reference/tab-widgets/inference-api/infer-api-task.asciidoc b/docs/reference/tab-widgets/inference-api/infer-api-task.asciidoc index 02995591d9c8a..227eb774a4a9f 100644 --- a/docs/reference/tab-widgets/inference-api/infer-api-task.asciidoc +++ b/docs/reference/tab-widgets/inference-api/infer-api-task.asciidoc @@ -36,7 +36,7 @@ the `cosine` measures are equivalent. ------------------------------------------------------------ PUT _inference/sparse_embedding/elser_embeddings <1> { - "service": "elser", + "service": "elasticsearch", "service_settings": { "num_allocations": 1, "num_threads": 1 @@ -206,7 +206,7 @@ PUT _inference/text_embedding/google_vertex_ai_embeddings <1> <2> A valid service account in JSON format for the Google Vertex AI API. <3> For the list of the available models, refer to the https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api[Text embeddings API] page. <4> The name of the location to use for the {infer} task. Refer to https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations[Generative AI on Vertex AI locations] for available locations. -<5> The name of the project to use for the {infer} task. +<5> The name of the project to use for the {infer} task. // end::google-vertex-ai[] From d15ad030e88b602092565aca145c16a03bba563a Mon Sep 17 00:00:00 2001 From: David Kyle Date: Fri, 6 Dec 2024 10:16:00 +0000 Subject: [PATCH 2/2] update intro --- .../semantic-search-semantic-text.asciidoc | 10 +++++----- .../search-your-data/semantic-text-hybrid-search | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/reference/search/search-your-data/semantic-search-semantic-text.asciidoc b/docs/reference/search/search-your-data/semantic-search-semantic-text.asciidoc index ba9c81db21384..673d44e85e6cd 100644 --- a/docs/reference/search/search-your-data/semantic-search-semantic-text.asciidoc +++ b/docs/reference/search/search-your-data/semantic-search-semantic-text.asciidoc @@ -14,15 +14,15 @@ You don't need to define model related settings and parameters, or create {infer The recommended way to use <> in the {stack} is following the `semantic_text` workflow. When you need more control over indexing and query settings, you can still use the complete {infer} workflow (refer to <> to review the process). -This tutorial uses the <> for demonstration, but you can use any service and their supported models offered by the {infer-cap} API. +This tutorial uses the <> for demonstration, but you can use any service and their supported models offered by the {infer-cap} API. [discrete] [[semantic-text-requirements]] ==== Requirements -This tutorial uses the <> for demonstration, which is created automatically as needed. -To use the `semantic_text` field type with an {infer} service other than ELSER, you must create an inference endpoint using the <>. +This tutorial uses the <> for demonstration, which is created automatically as needed. +To use the `semantic_text` field type with an {infer} service other than elasticsearch, you must create an inference endpoint using the <>. [discrete] @@ -98,7 +98,7 @@ and the necessary embeddings are generated. ------------------------------------------------------------ POST _reindex?wait_for_completion=false { - "source": { + "source": { "index": "test-data", "size": 10 <1> }, @@ -145,7 +145,7 @@ The {infer} endpoint used to generate the embeddings for the `semantic_text` fie GET semantic-embeddings/_search { "query": { - "semantic": { + "semantic": { "field": "content", <1> "query": "How to avoid muscle soreness while running?" <2> } diff --git a/docs/reference/search/search-your-data/semantic-text-hybrid-search b/docs/reference/search/search-your-data/semantic-text-hybrid-search index adf8b8489a480..b42db0b74ef7b 100644 --- a/docs/reference/search/search-your-data/semantic-text-hybrid-search +++ b/docs/reference/search/search-your-data/semantic-text-hybrid-search @@ -8,7 +8,7 @@ This tutorial demonstrates how to perform hybrid search, combining semantic sear In hybrid search, semantic search retrieves results based on the meaning of the text, while full-text search focuses on exact word matches. By combining both methods, hybrid search delivers more relevant results, particularly in cases where relying on a single approach may not be sufficient. -The recommended way to use hybrid search in the {stack} is following the `semantic_text` workflow. This tutorial uses the <> for demonstration, but you can use any service and its supported models offered by the {infer-cap} API. +The recommended way to use hybrid search in the {stack} is following the `semantic_text` workflow. This tutorial uses the <> for demonstration, but you can use any service and its supported models offered by the {infer-cap} API. [discrete] [[semantic-text-hybrid-infer-endpoint]]