Wait for ES response in insertDiscovery

This fixes intermittent test failures caused by running tests before all
metric names have finished being indexed.