Bloggify/elasticfire

Usage example

Closed this issue · 3 comments

Hi @IonicaBizau , I am building a react native mobile app , and it seems that this is better than Flashlight to use. However, I am new to all this and I'm wondering how do we use search(). I am assuming that I install this library, set some path, require this in main app and run when the app initializes. But then I am confused on how to use this in the Component where it should be used (in the search component)!

Not sure how React Native works, but the idea is, like you said, that you initialize the module once and then use the search method whenever you need it.

The search method simply calls the Elasticsearch' search, so, it accepts the same arguments.

e.g.

client.search({
  index: 'twitter',
  type: 'tweets',
  body: {
    query: {
      match: {
        body: 'elasticsearch'
      }
    }
  }
}).then(function (resp) {
    var hits = resp.hits.hits;
}, function (err) {
    console.trace(err.message);
});

Taken from the Elasticsearch docs.

@IonicaBizau What files should update to get this working for Cloud Firestore? is it possible?

Hmm, this library was written to work with Firebase. To make it work with Cloud Firestore, you would have to edit these files:

Hope that helps!