Check if the index is available before calling the query.