javascript – Need some help regarding the Elasticsearch engine and react js

I hope you are doing well, I need some help regarding the Elasticsearch engine. what I am doing is I am trying to create a search engine I have successfully post my data through kibana to elasticsearch engine. but “but how can I add the search component of elastyicsearch to my react app“, I have like 4 million records into the kibana index, when I try to search directly from react it take a long time to display records into my frontapp app with nodejs api. below is the code with nodejs but the problem with this code it just gives me 10 records only.

router.get('/tweets', (req, res)=>{
let query = {
    index: 'tweets',
    // size: 10000
}
if(req.query.tweets) query.q = `*${req.query.tweets}*`;
client.search(query)
.then(resp => {
    return res.status(200).json({
        tweets: resp.body.hits.hits
    });
})
.catch(err=>{
    console.log(err);
    return res.status(500).json({
        err
    });
});

});

Is there any way to impliment elasticsearch component directly to my reactjs app. like with the localhost:9200/index.. directly from the elasticsearch api?

Read more here: Source link