How to get all data?

Hi,

We are developing a mobile application and try to use algolia on backend.
We created a service on firebase that handles request from client and returns algolia users tables result to client.
We want to get all data (users info’s). So, we passed empty array to algolia, but it doesn’t work.

So, how to get all data?

This is my code:

var client = algoliasearch(ALGOLIA_APP_ID,ALGOLİA_KEY);
const index = client.initIndex(‘Users’);

if(data.length>1){
    index.search({
        filters:createQuery(data)
      },(err,content)=>{
        if(err) return res.send({Success:err.message})
       return res.send(content.hits)
      })
}else if(data.length===1){
    index.search({
        query:data.toString()
      },(err,content)=>{
        if(err) return res.send({Success:err.message})
        return res.send(content.hits)
      })
}else{
    index.search({
        query:""
      },(err,content)=>{
        if(err) return res.send({Success:err.message})
        return res.send(content.hits)
      })
}

Hi Ahmet,

If you want to export all data from your Algolia Index, try the browseAll() method.

Let us know how it went!

1 Like