Bots and AI crawlers can use up the monthly bandwidth of your Opensolr Index in days. They do it through the search page of your own website: every page they open there runs a query against your index. This page explains why it happens and every step you can take to stop it, in the order that helps most.
01 · Why bots use up your bandwidth
Your website sends a query to your Opensolr Index every time someone opens a search page or clicks a filter. It does not matter if that someone is a person or a bot. Opensolr counts the bytes each answer sends back: Solr Traffic Bandwidth.
- Filters and facets create endless pages. Every combination of filters is a new URL. A crawler follows every link it sees, so ten filters with a few values each turn into millions of URLs, and each one is a query.
- AI crawlers are aggressive. Bots that collect content for AI models open pages much faster than search engines, and often come back over and over.
- Scrapers and attack scripts call search pages directly, with random words, to copy your content or to test your site.
- A sudden spike overnight is almost always one of the above, not real visitors.
02 · Step 1: Keep crawlers out of search and filter pages
Well behaved crawlers, including the known AI crawlers (GPTBot, ClaudeBot, CCBot, Google-Extended, PerplexityBot and similar), read your robots.txt and obey it. Tell them not to open search results and filter URLs. Put a file named robots.txt at the root of your website, for example https://www.example.com/robots.txt. Change the paths and parameter names to the ones your site uses:
User-agent: * Disallow: /search Disallow: /*?q= Disallow: /*&q= Disallow: /*?f[ Disallow: /*&f[ Disallow: /*?filter= Disallow: /*&filter= User-agent: GPTBot User-agent: ClaudeBot User-agent: CCBot User-agent: Google-Extended User-agent: PerplexityBot User-agent: Bytespider User-agent: Amazonbot Disallow: /
The first block keeps every crawler away from search and filter URLs. The second block keeps the listed AI crawlers away from the whole site. Remove the second block if you want AI tools to read your content.
Then, in the HTML of your pages:
- Filter and facet links: add
rel="nofollow", so crawlers do not follow them. Example:<a href="/products?color=red" rel="nofollow">Red</a> - Search results pages: add
<meta name="robots" content="noindex, nofollow">in the<head>. - Filtered listing pages: add a canonical tag pointing to the page without filters. Example:
<link rel="canonical" href="https://www.example.com/products">
03 · Step 2: Cache search results on your server
When a bot opens the same search or the same filter combination many times, your server should answer from its own cache, without asking your Opensolr Index again. Keep each search result in a cache (Redis, Memcached, or the cache of your framework) for 60 seconds or more. Use the search words plus all the filters plus the page number as the cache key.
$key = 'search:' . md5($query . '|' . json_encode($filters) . '|' . $page); $result = $cache->get($key); if ($result === null) { $result = $solr->search($query, $filters, $page); $cache->set($key, $result, 60); }
Even a short cache turns thousands of identical bot requests into one query to your index. Your pages also load faster for real visitors.
04 · Step 3: Limit how fast one visitor can search
A person searches a few times per minute. A bot searches many times per second. Limit the number of search requests one IP address can make on your web server, and the bots that ignore robots.txt are slowed down automatically, without having to know who they are.
Nginx, 2 searches per second per IP address, with short bursts allowed:
# in the http { } block limit_req_zone $binary_remote_addr zone=search:10m rate=2r/s; # in the server { } block, on your search path location /search { limit_req zone=search burst=10 nodelay; limit_req_status 429; # ... your existing configuration for this path }
Apache: install the module mod_evasive, which blocks an IP address that sends too many requests in a short time. fail2ban works with any web server: it reads your access log and blocks, in the firewall, the IP addresses that request your search page too often.
If your website is behind a CDN or a proxy, limit by the real visitor address that the proxy forwards, not by the address of the proxy.
05 · Step 4: Make your search page harder to abuse
- Do not search on empty input. If the search box is empty or has one character, show the page without sending a query.
- Limit the page number. Do not let anyone ask for page 5,000 of the results. Show a fixed maximum, for example 50 pages.
- Show a challenge after many searches. When one IP address makes more searches than a person would, show a CAPTCHA before the next one.
- Block bad user agents you see in your access log, for example empty user agents or known scraping tools. User agents can be faked, so use this together with the rate limit, never alone.
06 · Step 5: If your page searches straight from the browser
Some sites call the Opensolr Index directly from JavaScript in the visitor's browser: search from the browser. In that case the address and the login of your index are visible in the page, and a bot can call your index directly, without going through your website. None of the steps above can stop it.
For a public website that receives bot traffic, send the searches through your own server instead (your page calls your server, your server calls the index). Then caching and rate limiting work, and the index stays hidden.
07 · Step 6: Lock and lighten your index on Opensolr
- Allow only your servers. With IP rules, only the addresses of your own servers can use your index. Nobody else can reach it, even with the password: IP restriction and IP rules by handler. By API: Add index IP access rule.
- Send fewer bytes per answer. Ask only for the fields your page shows (
fl) and only the rows it shows (rows). Every bot visit then costs a fraction of what it cost before: Solr best practices.
/select?q=laptop&rows=10&fl=id,title,url
08 · Find out who is using your bandwidth
- Request log API: search and facet every request your index received, by IP address, by path and by date, to see exactly where the traffic comes from: API: Get Index Request Log.
- Query Analytics: traffic over time and the most frequent queries, in the Control Panel: Query Analytics.
- Live Query Stream: watch the queries reaching your index as they arrive: Live Query Stream.
- Email at 90%: you get an email when an index has used 90% of its monthly bandwidth, so you can act before it is blocked.
Random words, the same filters repeated thousands of times, or very high page numbers in your log are the signature of bot traffic.
09 · If you already reached your bandwidth limit
An index over its monthly bandwidth answers every request with an error (403) until it is back under its limit. The allowance starts again on the 1st of every month: bandwidth.
To have your search working again right away, upgrade your plan with more bandwidth at https://opensolr.com/pricing. The index is unblocked once the new allowance is in place. When the steps on this page are in place and the bot traffic is gone, you can go back to a smaller plan from the same page: change or cancel your plan.
10 · Checklist
- robots.txt blocks search and filter URLs, and the AI crawlers you do not want.
- Filter links have
rel="nofollow", search pages havenoindex, filtered pages have a canonical tag. - Search results are cached on your server for at least 60 seconds.
- Your web server limits searches per IP address (nginx
limit_req, Apachemod_evasiveor fail2ban). - No query on empty input, a maximum page number, a CAPTCHA after too many searches.
- Searches go through your server, not straight from the browser.
- IP rules on your index allow only your servers.
- Every query asks only for the fields and rows the page shows.
- You check the request log when the 90% email arrives.