Question about the _search and _search methods.
When throwing queries, I use ScriptS core kNN with filters.
Then I create a similar query for _msearch using bulk.
In both cases, I get the same correct results.
In my case, I have about 500 such vectors with the same “should” (the length of “should” is more than 500 elements).
I throw them in _search in 8 threads and in _msearch (in bulk 8 vectors) and _search works faster.
It seems as if Elastic spends a lot of time parsing bulk.
Is there a way in bulk to pass “should” once, which is applied at the beginning of the search to all subsequent vectors?
Here is an example of accessing _search
GET my_index_1/_search
{
“size”: 10,
“query”: {
“script_score”: {
“query”: {
“bool”: {
“should”: [
{
“bool”: {
“filter”: [
{
“terms”: {
“places”: [
9,
8,
7,
6
]
}
},
{
“range”: {
“time”: {
“gte”: “2021-04-27 15:37:26||-30s”,
“lte”: “2021-04-27 15:37:26||+20s”
}
}
}
]
}
}
]
}
},
“script”: {
“lang”: “knn”,
“source”: “knn_score”,
“params”: {
“field”: “my_vector”,
“query_value”: [1, 2, 3, 4],
“space_type”: “cosinesimil”
}
}
}
}