Add _index_pattern tests

Provides 91% coverage to `_index_pattern.js`

Includes some minor refactoring to allow testing, and one bugfix related to popularizeField.

Also, break out `logstash_fields.js` so they can be reused in `stubbed_doc_source_response.js`