Elasticsearch Queries

  • Home

  • Add Index

    Add new index to the database


  • Search

    Free search of indexes


    • Dataset

      Dataset Sample

    • Search Query 1

      match

    • Search Query 2

      range

    • Search Query 3

      bool

    • Search Query 4

      bool + range

    • Search Query 5

      wildcard

    • Search Query 6

      fuzzy

    • Search Query 7

      filter

    • Search Query 8

      sort

    • Search Query 9

      size + from

    • Search Query 10

      avg

    • Search Query 11

      min + max

    • Search Query 12

      sum

    • Search Query 13

      boosting

    • Search Query 14

      regexp

    • Update Query 1

      conditional update

    • Update Query 2

      new field

    • Update Query 3

      update all

    ElasticSearch Queries

    By Chen Brilling

    About:

    This project is a full-stack application demonstrating different Elasticsearch capabilities, including executing search queries, updating documents, and adding new documents through a custom form.

    The website executes various queries, sending requests to a backend connected to Elasticsearch Cloud that I created, and displays the results on the front-end in both JSON format and as a formatted table.

    The front-end and back-end are deployed using Netlify, so any change committed to either side is automatically updated and deployed. All queries on the website have been tested using Kibana, the Elasticsearch JavaScript API, and the Elasticsearch Python API. The code can easily be adapted to integrate with any backend, regardless of the programming language.

    Backend (Node.js):

    Github project

    The backend is built with Node.js using the Express framework. I managed database access through API keys stored as environment variables. The API supports three primary endpoints:

    1. /api/add: Adds a new document to a specified index.
    2. /api/search: Searches within a specified index based on a custom query, script, or aggregation, returning different data depending on the request type using _search.
    3. /api/update: Updates documents that match the provided query using _update_by_query.

    The backend is deployed on Netlify and can be accessed atelasticsearch-backend.netlify.app.

    Frontend:

    Github project

    The front-end is developed using React, and React Router, and styled with Material UI and Tailwind CSS. All API calls are made using Axios. The list of queries is generated dynamically, so to add new queries, you only need to update a JSON file with the new data—no code changes are required.

    The front-end is also deployed on Netlify and can be accessed atelasticsearch-frontend.netlify.app.

    Backend (Flask):

    Github project

    I have developed an additional backend using Flask (Python), which mirrors the functionality of the Node.js backend. This backend supports all relevant API calls and maintains the same format and structured results as the Node.js version. The frontend can work with both backends since I made it so they support the same format and return identically structured results.