Q: Searching nested object with Elastic Search and Firebase Following the Flashlight GitHub example by Firebase.com, I got it to work as instructed to deploy on Heroku - but the way my data is structured, I think there might be a better way?
My data structure looks like this:
(root)pages
-->Firebase Unique ID
---->chat
---->content
------>Firebase Unique ID
-------->title
-------->description
-------->filter = article
---------->tags
------------tag 1
------------tag 2

I only want Elastic Search to return results based on matching the tags or the filter = article, but I get everything from pages down (all the chat, all the content regardless if it matched the result, but not content from other pages, etc...)
The path in config.js for the flashlight code is simply:
exports.paths = [
   {
      path:  "pages",
      index: "firebase",
      type:  "pages"
   },
   {
      path:  "event_entry",
      index: "firebase",
      type:  "events"
   }
];

I'm still early enough in development that I can change the structure of the data; I thought about:
(root) content
-->Firebase Unique ID
---->title
---->description
---->filter = article

And then simply storing the Firebase Unique ID in the pages object somewhere? 
As it stands right now, I'm parsing the result as so to check the tags and only show what is actually tagged with what I searched for and it's just... ugly...
function showResults(snap) {
  if( snap.val() === null ) { return; } // wait until we get data
  var dat = snap.val();
  var out = '';
  $.each(dat["hits"]["0"]["_source"]["content"], function(i, v) {
    for(var k in v.tags)
    {
      if(v['tags'][k]['text'] == $scope.search)
      {
        out += v.title + ": " + i + "<br>";
        console.log(i);
      }
    }
  });
  $("#results").text(out);
}

