Elasticsearch
Installation
SKILL.md
Mapping Mistakes
- Always define explicit mappings—dynamic mapping guesses wrong (first "123" makes field integer, later "abc" fails)
textfor full-text search,keywordfor exact match/aggregations—using text for IDs breaks filters- Can't change field type after indexing—must reindex to new index with correct mapping
- Set
dynamic: "strict"to reject unmapped fields—catches typos in field names
Text vs Keyword
textis analyzed (tokenized, lowercased)—"Quick Brown" matches search for "quick"keywordis exact bytes—"Quick Brown" only matches exactly "Quick Brown"- Need both? Use multi-field:
"title": { "type": "text", "fields": { "raw": { "type": "keyword" }}} - Sort/aggregate on
title.raw, search ontitle