Vector search is very slow

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

  • number: “7.10.2”,
  • build_flavor: “oss”,
  • build_type: “tar”,
  • build_hash: “747e1cc71def077253878a59143c1f785afa92b9”,
  • build_date: “2021-01-13T00:42:12.435326Z”,
  • build_snapshot: false,
  • lucene_version: “8.7.0”,
  • minimum_wire_compatibility_version: “6.8.0”,
  • minimum_index_compatibility_version: “6.0.0-beta1”

Describe the issue:
The KNN search is super slow its taking 10sec to 1min for simple knn search.

I am using the embedding vector stored in ES with 1536 dims.
“embedding”=>{
“type”: “knn_vector”, “dimension”: 1536, “index”: true, “similarity”: “cosine”
}

And following is the sample query.
{
“size”: 40,
“min_score”: 0.1,
“from”: 0,
“query”: {
“knn”: {
“embedding”: {
“vector”: [-0.010775621, -0.0000717875, -0.010133512, … -0.014288769],
“k”: 10
}
}
},
“post_filter”: {
“bool”: {
“should”: [{
“terms”: {
“intent_id”: [374002, 374002, “373931”, “373930”]
}
}, {
“terms”: {
“pack_id”: [3961]
}
}]
}
}
}