Skip to main content

Connecting to Elasticsearch with a Custom Service

This service wraps the Elasticsearch Node.js client and provides the following implementation:
  • Get a list of records (with Pagination and Filters handling)
  • Get a simple record
  • Create a record
  • Update an existing record
  • Delete a record

Prototype

Full implementation

You need to add Elasticsearch Node.js client to your projectnpm install @elastic/elasticsearch

Creating utils to convert Express query filters to Elasticsearch one

This utils takes an object representing a filter from the ForestAdmin UI and transforms it into a filter for Elasticsearch.
  • Date filters
  • Number filters
  • Text filters
  • Enum filters

Full implementation

We expose utils to parse filters through forest-express-sequelize since version 7.6.0