Limit the number of projects that could be sent in an ElasticSearch query
Related to our plan to introduce application limits across GitLab in &1737 we may also wish to limit the number of explicitly authorized projects we will search for in a single ElasticSearch query.
Right now the way our global search works is that we include a query that should match any public project and a predefined set of private projects the user has access to. We should prevent the number of private projects passed in this query to be within some sensible limit (eg. 1000) as a large number of id matches like this may be very inefficient for the ElasticSearch cluster.
I'm not sure but I could imagine that ElasticSearch will scale linearly with the number of ids it's being asked to match against and hence this number should be kept to a sensible limit.