How to use elasticsearch with react native?
Asked Answered
F

2

6

I want to use elasticsearch for my mobile app (android and ios).

I installed elasticsearch-js using Node.js : https://github.com/elastic/elasticsearch-js

But I couldn't manage to make it works. So I made some researches and I read that it was a bad idea to "directly" use elasticsearch on mobile and that it was better to use an API.

I don't understand: elasticsearch-js is not already what I need ? If it is not the case then what should I use ?

In advance thanks

Fillet answered 7/12, 2017 at 16:12 Comment(2)
I'm having the same problem too. I am using firebase as backend, and in react native I am using react-native-firebase which links firebase to each platform using android sdk and ios sdk. I have no idea what's exactly needed to use elastic search with react native :(Deckard
What’s your backend? Firebase, AWS?Burdett
T
8

Elasticsearch has to be back end. It's not something you install on a mobile or something. The minimum spec to have something working in production is like 5 instances of ES with 8Go of ram and 1 to 2 vCPU per server.

Elasticsearch has an API that you can call to have real time search. You can also tune the system to have suggestions or fuzzy searches (and even more). An ebook is available online for more info : https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html

It's not a plugin that you can add in the front.

On your app (Desktop/Web/Mobile) you need to implement an input where you do a specific search based on what the user writes inside it.

It's like an intern google engine (the principle between Google and ES are the same). You build the server and implement its API on your front.

I can give you a hand to install ES.

For React side as I said you can you consume the API : https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html

But there is npm package that handle that for you. Read this tutorial (with React but I'm pretty sure you can use this for your project) : https://codeburst.io/how-to-build-an-e-commerce-search-ui-with-react-and-elasticsearch-a581c823b2c3

Torn answered 24/1, 2018 at 8:21 Comment(1)
as per your suggestion appbaseio's reactive search seems to be the option if we want to implement elastic search with react native with following package npmjs.com/package/@appbaseio/reactivesearch-native . Only concern here is its 3years old as on today(12-11-2021). But web they are updating frequently.Pugh
P
0

I would personally use the npm package elastic-builder. It is a good query DSL which can be used as an intermediary between your app and elastic search

Piccadilly answered 30/7, 2024 at 11:27 Comment(1)
any affiliation? /help/promotion also, please show how to use it to solve the problem in the question.Jenette

© 2022 - 2025 — McMap. All rights reserved.