Middleware Logic Layer

Hi All,

Apologies if this is the wrong section to be posting in. Hoping to get some advice / insights if there is anything available in market to use for our use case.

We have an ELK cluster that is running our site search (ecomm). We currently maintain some search logic within our backend application, removing certain terms from searches, rewriting some searches etc... It is not scalable nor manageable for us and we want to pull it out into its own service where we can maintain different logic (eg. someone searches for Apple iPhone use search template x, or someone searches for "Nike Voucher" remove word voucher and use search template y).

The current architecture of our application is pretty straight forward;

ReactJS Front End -> Rails Backend -> ELK Cluster

The logic currently sits in the Rails Backend.

In our mind, it would look like this;

ReactJS Front End -> Rails Backend -> Search Logic Middleware -> ELK Cluster

Are there any recommended tools, templates or starting points for the Search Logic Middleware that exist / can be recommended by the community?