Drupal getting a 504 Gateway error from SOLR in Acquia Search

Just a note in case someone else ends up in the same mess that I did: if you get a gateway timeout from Solr in Acquia Search (or elsewhere) then look at the field types you’re using in Drupal in the search index. It seems that any of the lovely ‘ngram’ fields that allow for partial word searching use a disproportionately high amount of CPU in Solr and that will often cause timeouts.

You will often see messages like this in your logs:

Drupal\search_api_solr\SearchApiSolrException while indexing item entity:professional_register_org/366:und: Solr endpoint https://xxx.acquia.com:443/solr/AHMR-187252.prod.imiacp/ unreachable or returned unexpected response code (code: 504, body: 504 Gateway Time-out

The best way around this is to use fulltext fields for most fields that you want to search within and maybe have one aggregated field that covers all content types which has the ngram field type.

Oh, and don’t try deleting and recreating the index in the Acquia admin interface as that fails most of the time. ­čÖü

You May Also Like