What should be the optimal value of K with respect to size in search query?
Hi @shashi
Good question. Answer will probably be use case specific, but in general, I recommend setting k=size if you are not filtering and k = y* size if you are filtering (select y based on how much the space will be reduced by filtering).
k parameter is passed to the graph and k results are returned. There is (generally speaking) 1 graph per segment. There are n segments per shard. The shard would collect the n*k results and return the top “size” to the coordinating node. If there are z shards, the coordinating node will take the z*size results and return the top size of those results.
Now, that might make it seem like k should be less than size. The problem with this is that a particular segment may have the top x results. Assume size >= x > k. In this case, x - k results that are in the top size results would not get returned.