Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
kNN search with VertexAI's embeddings models configured via Elastic's Inference API
PUT _scripts/google-template-knn-multioutput
{
"script": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#knn template
#knn template with custom multilingual dense model (chunked)
PUT _scripts/google-template-knn
{
"script": {
Expand Down Expand Up @@ -36,8 +36,8 @@ GET nqdataset-simplified-clean-semantictext-e5/_search/template
{
"id": "google-template-knn",
"params": {
"query": "italian food",
"index_name": "nqdataset-simplified-clean-semantictext-e5",
"query": "What's the most famous food in Italian cousine?",
"index_name": "<your-index-name-here>",
"num_hits": 1
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
PUT _scripts/google-template-knn-multioutput
#ELSER sparse_vector search template with ELSER (chunked)
PUT _scripts/google-template-elser
{
"script": {
"lang": "mustache",
"source": {
"_source": {
"excludes": [ "title_embedding", "description_embedding", "images"]
},
"_source": false,
"size": "{{num_hits}}",
"knn" : [
{
"field": "description_embedding",
"k": 5,
"num_candidates": 10,
"query_vector_builder": {
"text_embedding": {
"model_id": "googlevertexai_embeddings_004",
"model_text": "{{query}}"
"query": {
"nested": {
"path": "document_text.inference.chunks",
"query":{
"sparse_vector":{
"field": "document_text.inference.chunks.embeddings",
"inference_id":".elser-2-elasticsearch",
"query":"{{query}}"
}
},
"boost": 0.4
},
{
"field": "title_embedding",
"k": 5,
"num_candidates": 10,
"query_vector_builder": {
"text_embedding": {
"model_id": "googlevertexai_embeddings_004",
"model_text": "{{query}}"
}
},
"boost": 0.6
"inner_hits": {
"size": 1,
"name": "{{index_name}}.document_text",
"_source": "*.text"
}
]
}
}
}
}
}
}

#Run the ELSER chunked templated search - chunks returned, not full documents
GET nqdataset-simplified-clean-semantictext/_search/template
{
"id": "google-template-elser",
"params": {
"query": "What's the most famous food in Italian cousine?",
"index_name": "<your-index-name-here>",
"num_hits": 10
}
}