Use the text data type for human-readable content such as movie titles, blog posts, reviews, news, tweets, and log messages. Elasticsearch analyzes each text field before persisting it, preparing the content for full-text search. section 4.5.1 section 4.4
A text mapping is straightforward: "field": { "type": "text" }. During indexing, an analyzer can remove punctuation and special characters, tokenize the text, normalize case, stem words, and apply other natural-language rules. Elasticsearch uses the standard analyzer by default. section 4.5.1
Map a movie title for search
PUT movies { "mappings": { "properties": { "title": { "type": "text" } } } } The title is indexed as analyzed text, so queries can search its analyzed terms rather than requiring the original title as one unchanged value. section 4.5.1
Choose related mapping features according to how the field will be searched:
- Add a keyword multi-field when the same value also needs structured, unanalyzed access. section 4.7
- Add completion when the field must support completion-oriented access, using dot notation for the additional type. section 4.7
- Use token_count as an additional field when searches need the analyzed word count, such as titles containing four words. section 4.5.1
- Dynamic mapping can infer a string field as text, but explicit mappings make the intended schema clear. section 4.2 section 4.5.1
"The movie was sick!!! Hilarious :) :) and WITTY ;) a KiLLer 👍"
Inspect the movie-review input that is transformed during analysis before its searchable terms are stored. section 4.5.1
