Term queries look for exact token matches. A term query is like an exact string match, but at the token level.

Overview

Unlike match or phrase queries, term queries treat the query string as a finalized token. This means that the query string is taken as-is, without any further tokenization, lowercasing, stemming, etc. Term queries use the === operator. To understand exactly how it works, let’s consider the following two term queries:
-- Term query 1
SELECT description, rating, category
FROM mock_items
WHERE description === 'running';

-- Term query 2
SELECT description, rating, category
FROM mock_items
WHERE description === 'RUNNING';
The first query returns:
     description     | rating | category
---------------------+--------+----------
 Sleek running shoes |      5 | Footwear
(1 row)
However, the second query returns no results. This is because term queries look for exact matches, which includes case sensitivity, and there are no documents in the example dataset containing the token RUNNING.

How It Works

Under the hood, === simply finds all documents where any of their tokens are an exact string match against the query token. A document’s tokens are determined by the field’s tokenizer and token filters, configured at index creation time.

Examples

Let’s consider a few more hypothetical documents to see whether they would be returned by the term query. These examples assume that index uses the default tokenizer and token filters, and that the term query is running.
Original TextTokensMatchReasonRelated
Sleek running shoessleek running shoesContains the token running.
Running shoes sleeksleek running shoesContains the token running.
SLeeK RUNNING ShOeSsleek running shoesContains the token running.Lowercasing
Sleek run shoesleek run shoeDoes not contain the token running.Stemming
Sleke ruining shoezsleke ruining shoezDoes not contain the token running.
White jogging shoeswhite jogging shoesDoes not contain the token running.

Fuzzy Term

Fuzzy term has not yet been implemented in v2. Please continue to use v1 for this capability.