How does one set the dimension in the query to avoid this message?
while setting up index mapping, you will have a "dims" field along with type: "dense_vector".
set it to "dims": 768
Yes, I have that in the index mappings, but where is the query getting the 384 value -- how would I set that?
"path": {
"type": "text",
"term_vector": "with_positions_offsets",
"analyzer": "text_keep_stopwords",
"search_analyzer": "text_drop_stopwords",
"index_options": "offsets",
"store": "true"
},
"path_embedding.predicted_value": {
"type": "dense_vector",
"dims": 768,
"index": true,
"similarity": "cosine"
},
"passage": {
"type": "text",
"analyzer": "text_keep_stopwords",
"search_analyzer": "text_drop_stopwords",
"term_vector": "with_positions_offsets",
"index_options": "offsets",
"store": "true"
},
"passage_embedding.predicted_value": {
"type": "dense_vector",
"dims": 768,
"index": true,
"similarity": "cosine"
},
Can you share your insert script (only vector key value)
I'm using a bulk ingester:
BulkIngester<ObjectNode> ingester = BulkIngester
.of(b -> b.client(_client)
.maxOperations(100).flushInterval(20L, TimeUnit.SECONDS)
.listener(ESUtils.getBulkListener(_logger)));
With the pipeline defined like:
client.ingest().putPipeline(pr -> pr.id("rdp_pipeline")
.processors(p -> p
.inference(i -> i.modelId(".multilingual-e5-small_linux-x86_64")
.fieldMap("passage", JsonData.of("text_field"))
.targetField("passage_embedding")))
.processors(p -> p
.inference(i -> i.modelId(".multilingual-e5-small_linux-x86_64")
.fieldMap("path", JsonData.of("text_field"))
.targetField("path_embedding")))
);
And I build an ObjectNode and send that for ingestion:
String path = passage.get("path").asText().replace("~", " ~ ");
int linenum = passage.get("lineNum").intValue();
String text = passage.get("text").asText();
ObjectNode content = s_objectMapper.createObjectNode();
content.put("passage", text);
content.put("path", path);
content.put("url", url);
content.put("title", title);
content.put("linenum", linenum);
content.put("filestem", filestem);
content.put("id", id);
content.put("language", langFamily);
ingester
.add(op -> op.index(idx -> idx.index(indexName).document(content)));
I think the model used produces a output embedding of size 384 (intfloat/multilingual-e5-small) whereas you have configured 768 in index mapping
You are absolutely correct. I didn't realize this limitation. Thank you.