Reindex Search API indexes for Behat testing
The ultimate solution is $search_api_index-&gt;server()-&gt;commit() which needed because, there's a commit delay which you can set inside the solrconfig.xml and this delay cause the problem. (Or you can just sleep(1) your code, but that's not flexible at all and ugly...)