A non-text field stores structured values as they are: Elasticsearch does not split them into tokens or normalize them with synonyms or root words. Numeric, date, keyword, and constant-like fields fit this model. section 9.2.1 section 2.4
Use non-text fields for structured search, where a value either matches or does not. Term-level queries target these exact values instead of calculating relevance; enumerated text such as CREATED or CANCELLED can also work. section 9.2.1 section 8.9
Book fields and an exact movie query
A book document can contain "edition": 3, "amazon_rating": 4.7, and "release_date": "2017-12-27". Elasticsearch derives these as long, float, and date fields. For a movie title stored as analyzed text, this query does not match the original phrase because term queries compare the supplied value directly with indexed tokens: GET movies/_search { "query": { "term": { "title": "The Godfather" } } } Use a term query on a non-text field, or on text deliberately modeled as an enumeration or constant; use full-text search for ordinary prose. section 9.2.2 section 2.4
Listing 9.2 Using a term-level query on a text field
GET movies/_search
{
"query": {
"term": {
"title": "The Godfather"
}
}
}
Run the movie search request to observe exact term matching against an analyzed title. section 9.2.2
