How to build a simple search engine dashboard with Docker, Elasticsearch, and Plotly.

In this article, I will build a full-text search functionality that allows finding relevant articles by searching for a specific word or phrase across thousands of news articles.

Prerequisites

  • Elasticsearch
  • Plotly

Docker

Docker is like magic ✨ in the box.

Elasticsearch

Elasticsearch is an awesome search engine for performing a fast ⚡️ search in the text.

Install Docker Desktop on Windows

  • Windows 10 64-bit: Pro, Enterprise, or Education.
  • Hyper-V and Containers Windows Features must be enabled.

Install Elasticsearch with Docker

docker pull docker.elastic.co/elasticsearch/elasticsearch:7.10.1

To start a single-node Elasticsearch cluster for development or testing, run docker run command:

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.10.1

For more details, visit here.

Search Engine

Load Data

  • url
  • title
  • description
  • author
  • publishedAt
  • source

You can download the dataset from here.

Creating an index

An index is a container that stores and manages related documents. We can create index with mapping definitions that defines how Elasticsearch should process a document.

Use PUT method to create an index news:

Indexing a document

A document is key/value pairs of JSON objects.

Use a POST method to add articles to the “news” index:

After creating the index with mapping and indexing documents, we are ready for search and query.

Search and Query

  • count matched results
  • query single term
  • query multiple terms
  • wildcard query

Dashboard with Plotly

You can find the full project here.

Enjoy 😀.

Data Scientist

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store