[EE] Use limit for search count queries
EE version of gitlab-ce!16502. This version adds minor view change related to elasticsearch support which is in only in EE.
Elasticsearch was not tested, this patch assumes that .without_count
method can be called on search query used when elasticsearch is enabled (I don't see why it couldn't).