I have successfully integrated Flashlight into my Angular 2 project, utilizing its powerful functionalities:
- Automatically indexing specified Firebase paths to an ElasticSearch cluster and monitoring changes to re-index any modifications.
- Responding to query objects written to a chosen Firebase path (e.g., 'search/request'), then writing the ElasticSearch responses to another specified Firebase path (e.g., 'search/response').
The response structure in Firebase is as follows:
https://i.sstatic.net/uiprH.png
This is how I execute a search using Angularfire 2:
searchThreads(term: string) {
let queryBody: Object = {
index: 'firebase',
type: 'thread',
q: term
}
this.requestKey = this.af.database.list('/search/request').push(queryBody).key
}
If I need the raw search results with all paths shown in the image above, I would do something like this:
this.af.database.list(`search/response/${this.requestKey}`)
Specifically, I am interested in extracting the objects found at _source
. My goal is to loop through the response hits and display those objects on my page. How can I achieve this by creating an observable array?