Elasticsearch Term Query Basics
📖 Scenario: You are working with an Elasticsearch index that stores information about books in a library. Each book has fields like title, author, and genre.Your task is to find books that exactly match a specific genre using a term query.
🎯 Goal: Build an Elasticsearch term query to find all books where the genre field exactly matches the value "Science Fiction".
📋 What You'll Learn
Create an Elasticsearch index mapping with fields:
title, author, and genre.Add a configuration variable for the genre to search for, named
search_genre with the value "Science Fiction".Write a term query that searches the
genre field for the exact value in search_genre.Complete the query JSON structure to be ready for execution.
💡 Why This Matters
🌍 Real World
Searching for exact matches in a large collection of documents, such as finding books by genre in a library database.
💼 Career
Understanding term queries is essential for roles involving search engine development, data indexing, and backend search optimization.
Progress0 / 4 steps