Adding Metadata to search results.

Search results can now have metadata attached to them using the same mechanism
as the /meta handler uses. The change also includes:
  * Some cleanup of the elasticsearch interface
  * Search Time and Total in search response
  * More tests
That's because the Index method is to create a reference to access the database with a canned index, which is the only way we ever do it. This check means that if the database isn't configured the index won't be either. For all other methods it is a failure.