Skip to content

Commit 80059b2

Browse files
Adding documentation highlighting the usage of copy_to field
1 parent 94bf667 commit 80059b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

notebooks/search/09-semantic-text.ipynb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,9 @@
400400
"source": [
401401
"Notice how we configured the mappings. We defined `plot_semantic` as a `semantic_text` field.\n",
402402
"The `inference_id` parameter defines the inference endpoint that is used to generate the embeddings for the field.\n",
403-
"Then we configured the `plot` field to [copy its value](https://www.elastic.co/guide/en/elasticsearch/reference/current/copy-to.html) to the `plot_semantic` field."
403+
"Then we configured the `plot` field to [copy its value](https://www.elastic.co/guide/en/elasticsearch/reference/current/copy-to.html) to the `plot_semantic` field.\n",
404+
"\n",
405+
"While the use of `copy_to` is not required to leverage semantic search it does enable use cases like hybrid search where semantic and lexical techniques are used together. The contents of the `plot` field are copied into the `plot_semantic` field which enables searches over both fields at once."
404406
]
405407
},
406408
{
@@ -613,6 +615,8 @@
613615
"These results demonstrate that the application of lexical search techniques can help focus the results, while retaining many of the advantages of semantic search.\n",
614616
"In this example, the top search results are all still movies involving organized crime, but the `multi_match` query keeps the long tail shorter and focused on movies in the crime genre.\n",
615617
"\n",
618+
"Notice how we specify the `plot` field in the multi_match query. The content of this field is also contained in the semantic field `plot_semantic` due to the use of `copy_to` this allows the boolean query to consider both lexical and semantic similarity of the `plot` field.\n",
619+
"\n",
616620
"Note the `boost` parameters applied to the `multi_match` and `semantic` queries.\n",
617621
"Combining lexical and semantic search techniques in a boolean query like this is called \"linear combination\" and when doing this, it is important to normalize the scores of the component queries.\n",
618622
"This involves consideration of a few factors, including:\n",

0 commit comments

Comments
 (0)