Hello!
I use Elasticsearch 7.14 and I have a mapping like this:
{
"mappings": {
"properties": {
"vector": {
"type": "dense_vector",
"dims": 512
},
"category": {
"type": "keyword"
},
"name": {
"type": "keyword"
},
"source": {
"type": "keyword"
}
}
}
}
This index is primarily used to search by vector using cosine similarity, like this:
{
script_score: {
query: { match_all: {} },
script: {
source: '(1.0 + cosineSimilarity(params.query_vector, \'vector\'))',
params: {
query_vector: vectorArray
}
},
min_score: 0
}
}
I have around 600k documents in this index, and for this amount of documents I think sharding is not necessary. However, even when I have 3 shards, I have total search time of 5 seconds, according to Kibana devtools.
Is there something else I could do to improve search speed?