Skip to content

๐Ÿ› React + Elasticsearch - UI components for building data-driven search experiences

License

Notifications You must be signed in to change notification settings

betagouv/react-elasticsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

React Elasticsearch

Version Downloads License

UI components for React + Elasticsearch. Create search applications using declarative components.

Usage

๐Ÿ‘‰ Documentation and playable demo available here.

const MySearchComponent = () => (
  <Elasticsearch url="http://example.org/search">
    <SearchBox id="mainSearch" fields={["title"]} />
    <Facet id="actors" fields={["actors"]} />
    <Facet id="releasedYear" fields={["releasedYear"]} />
    <Results
      id="results"
      items={data =>
        // Map on result hits and display whatever you want.
        data.map(item => <MyCardItem key={item._id} source={item._source} />)
      }
    />
  </Elasticsearch>
);

Install

npm i react-elasticsearch
yarn add react-elasticsearch

Develop

You can test components with storybook (20+ examples).

npm run storybook

Main features

  • ๐Ÿ Released under MIT licence.
  • ๐Ÿ‘ฉโ€๐ŸŽจ Each component is built with React and is customisable. Not too much extra features nor magic.
  • ๐Ÿ’… It comes with no style so it's the developers responsibility to implement their own.
  • ๐Ÿฟ 35.32KB gzipped for the whole lib, compatible with old browsers: >0.03% usage.
  • ๐Ÿ”ฎ No legacy: created in 2019, updated in 2021 with hooks.

Why?

We started building the search experience of the french Cultural Heritage Open Platform with ReactiveSearch, a well-known search UI components lib for React. After some weeks, we realized we had spent a lot of time tweaking and hacking the lib; we had rewrote almost every components ourselves. We opened issues and pull requests on the repository, but it seemed the lib was a bit stuck in a rewrite process. We found out that we need a simple lib that can be easily extended with a similar API, we created this one. This lib has many less feature than others, it's not even a decent competitor. But since it helped us building a search experiences, it has been released. Hope it could help you!

Contributing

Open issues and PR here: https://github.com/betagouv/react-elasticsearch

About

๐Ÿ› React + Elasticsearch - UI components for building data-driven search experiences

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •