Set up index mappings for Elastic Search
Customise indexed json output for PA

Nests relations inside JSON so that we can search the relations easily.
Remove mappings from elastic search PA model

ES defaults are sane enough to not need custom mappings
Includes elastic search model callbacks

ES Index will be created when PAs are created, i.e. during the import.
Merge branch 'automatic-import' into elastic-search

* automatic-import: (36 commits)
  fix sources importing for ProtectedArea
  save year as null for particular cases in attribute.rb
  temporary fix for unappropriate eager loading in prod env
  memoize source_table in release.rb
  add import_tables method to Release
  replace DB constant with actual method in generator.rb
  use method db instead of DB constant in release.rb
  Fixes db config bug in importer
  add unlocking to finalisation of import
  Temporarily update WPDA import bucket for testing
  make db.rake use PostgresHandler.seed
  add seed method to PostgresHandler
  add dump_path in ImportTools
  Docs for new lazy seeding task
  Adds a lazy seeding task that works from a db dump
  rename methods in RedisHandler to get rid of import refs
  make finalise swap the databases
  add rename_database method to PostgresHandler
  use MaintenanceSwitcher in Import
  add ImportTools::MaintenanceSwitcher
  ...
Production server uses correct AWS bucket
Improves speed of importer, after stats introduction

Stats require countries to have multiple, complicated geometries. By
selecting only `id`, as we're doing here, ActiveRecord won't try and
load those geometries in to memory (which is very, very expensive).
Test helper now handles preparing the test DB automatically

rake db:test:prepare is deprected, and is replaced by this line.
Includes WDPA ID as identifier for indexed PAs
Merge branch 'master' into elastic-search

* master: (128 commits)
  Cleans up regional stats code
  Cleans up documentation
  Refactors geometry populator
  Removes migration that has no parent
  refactors repair geometries queries
  adds repair geometry befor intersecting marine areas
  adds repair_query template to geometry_repairer
  changes buffering to 0.0
  Improves performance of regional stats page
  adds geometry repairer to repair geometries before dissolving
  adds repair_geometries to stats rake task
  adds repair_geometries test
  Quit sending me emails
  Correct syntax for iteration in Ansible 1.6
  Country geometry import ignores postgres errors
  Use all possible connection configs for PG restore
  Remove broken migration
  Fix styling of annular stats graphs
  fixes ts area sum bug
  dds clear cache to stats calculator
  ...

Conflicts:
	config/secrets.yml
	db/structure.sql
Fixes failing data standard test

The country relation creator was changed to only select `id` so that the
geometries weren't loaded in to memory, however the test was using the
country name to ensure the correct object was being returned. Changed
the test to use ID instead.
Removes no-longer required rake task
Moves model geometry methods in to a concern
Surrender to JSLint
Search reindexer bulk imports models to Elastic Search

Indexing with Elastic Search is different: it requires the attributes of
the searchable models to be saved in to the Elastic Search index, a la
mongodb. This is pretty slow, so here we use the ES _bulk import API by
building JSON structures for the given models and then sending them to
the API.

Currently batched to 1000 records per API call to hopefully reduce any
memory usage issues.
Improves speeds of tests by ~1s

Some tests were creating more models than were needed to confidently
test a theory.
Removes index logging

Upsets test output
Searchable models return IDs

So that they can be matched back to ActiveRecord models when returned
from Elastic Search.
Introduces ElasticSearch query builders

Matchers build hashes for different types of ES queries that can be
converted in to JSON.
Search now uses Elastic Search

The Search class uses `elasticsearch-ruby` to query an Elastic Search
index.

The queries are built using Search::Query, which uses some basic child
objects to handle the creation of the matchers, filters, etc. that make up
queries.