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
minor point:

   if err := writeSettings(...); err != nil {
   }

is preferable when reasonable. saves looking for potential side effects.