How JJ Food Service Uses the Elastic Stack for Log Analytics and Search

JJ Food Service Ltd is a B2B food services company founded in 1988. We provide services to about 60,000 individual accounts, with eight branches across the UK supplying all food industry sectors, from restaurants, pubs and hotels to schools, universities and local authorities. The business offers a wide range of fresh, chilled, ambient and frozen products, a selection of high-quality own-label lines, and packaging and cleaning materials, all competitively priced. 


At JJ Food Service Ltd we use Elastic products in a number of ways, firstly we use the Elastic Stack - Elasticsearch, Kibana, and Logstash -  to power our logging system. Secondly we use Elasticsearch in a more conventional way, for product search. Our web application is modelled in a fairly unconventional way; in the front end we use Google Polymer, Web Components talk to JSON APIs via vanilla Ajax and WebSocket requests. We maintain a high level of security on our front facing servers, these just act as brokers between the client and middleware which is running Hapi JS with the support of Seneca Micro Services. This layer does all the heavy lifting. Our backend data comes from Microsoft Dynamics AX, an enterprise ERP system for which we are a reference implementation. This is an eagle’s eye view of our web application.

Detecting Errors Made Easy

It is important to know what state a system is in from minute to minute. Knowing when errors occur and how they fit into the context of our system has helped us to react swiftly to issues, change our approach and make our system more resilient, for example are customers getting their passwords wrong? By aggregating and analyzing our logs with the Elastic Stack, it gives us clarity. Not only that but it also helps us to resolve customer issues, track journeys simply by search. An interesting detail to how we use the Elastic Stack is that we do not write logs to files, instead we directly pipe log events into a Redis Pub/Sub, Logstash then consumes the Pub/Sub events directly and feeds them to Elasticsearch. It is faster, better and we love it! There will be more developments on that front in the future. For example we are really excited about Beats and Metricbeats and how it could further improve our system visibility. 


Figure 1 - Custom application errors exposed

Creating a Better Search Experience for Customers

Lastly product search. We have separated Elasticsearch instances for this and we developed the infrastructure to feed Elasticsearch from the latest products that emerge from our AX ERP system. This is done at least once a day, we use the excellent elasticsearch.js NodeJS client for this, making bulk inserts and general management of Elasticsearch easy. Our search on our website is exposed as a Microservice, via Seneca.


Figure 2 - Search as a microservice 

What this gives us is a really nice decoupling of Elasticsearch and our server and its logic. We can insert our own logic backed by a reliable client such as elasticsearch.js Node client. Service Oriented Architecture done right.  Elasticsearch allowed us to model our Microservices with great flexibility, allowing us to create phased searches that will take into account both exact product matches, store filtering (as our products can be branch specific) and fuzziness.  All of this helps us return the right products to our customers. For example we have greatly decreased the number of zero results that we used to have, by applying fuzziness intelligently, regular expression searches and mutli-field term searches in a layered way will usually return something relevant, it’s a great improvement.

Again our work is never done and we will continue to explore the Elastic Stack and its capabilities into the future.

Erdem Ekici, is taking the lead on our cutting edge frontend web development.

Karamjit Kang, a recent addition to our team who was instrumental in testing our Elasticsearch implementation.

Jason Lane, is a Senior Engineer at JJ Food Service with 20 years of experience in web development. His passion has always been for high performance, concurrent, real time systems. He has worked across a broad variety of ecosystems and is mainly found working in Node JS these days.


Figure 3 - The team (in order of appearance from left to right) Erdem, Jason & Karamjit

  • We're hiring

    Work for a global, distributed team where finding someone like you is just a Zoom meeting away. Flexible work with impact? Development opportunities from the start?