» Rust: Building Full-Text Search API with ElasticSearch » 1. Introduction » 1.1 Preparation

Preparation

Install Rust

See How to install Rust?.

Note: This project uses rustc 1.77.2.

Pick an editor

Pick your favorite editor or use Visual Studio Code.

Learn Rust basics

If you're not familiar with Rust, you may try this tutorial: "Quick Introduction to Rust."

In text retrieval, full-text search refers to techniques for searching a single computer-stored document or a collection in a full-text database. Full-text search is distinguished from searches based on metadata or on parts of the original texts represented in databases.

A LIKE SQL query against millions of rows of text data can take minutes to return; whereas a full-text query can take only seconds or less against the same data, depending on the number of rows that are returned.

Elasticsearch

es logo

Elasticsearch is a distributed search and analytics engine built on Apache Lucene. Since its release in 2010, Elasticsearch has quickly become the most popular search engine and is commonly used for log analytics, full-text search, security intelligence, business analytics, and operational intelligence use cases.

Axum web framework

Axum is a web application framework that focuses on ergonomics and modularity.

Minimal example:

use axum::{
    routing::get,
    Router,
};

#[tokio::main]
async fn main() {
    // build our application with a single route
    let app = Router::new().route("/", get(|| async { "Hello, World!" }));

    // run our app with hyper, listening globally on port 3000
    let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
    axum::serve(listener, app).await.unwrap();
}