Dynamic Fields
Dynamic Fields
Makaira supports dynamic field typing based on naming conventions. By using specific suffixes in your field names, you can control how fields are indexed and searched.
Field Name Suffixes
| Suffix | Elasticsearch Type | Use Case |
|---|---|---|
*_date | date | Date/time values |
*_float | float | Decimal numbers |
*_int | integer/long | Whole numbers |
*_bool | boolean | True/false values |
*_str_short | text + keyword | Short text (names, codes) |
*_str_long | text | Long text (descriptions) |
*_str_decomposed | text | Compound words (German) |
*_str_keyword | keyword | Exact match only |
*_split_number_string | text | Product codes with delimiters |
*_split_everywhere | text | Split on all delimiters |
*_data_only | disabled | Storage only (not searchable) |
Examples
Date Fields
{
"delivery_date": "2024-02-01",
"release_date": "2024-03-15 10:00:00"
}Use for: Release dates, availability dates, expiry dates.
Numeric Fields
{
"weight_float": 2.5,
"quantity_int": 100,
"min_order_int": 5
}Use for: Weights, quantities, dimensions, any numeric values.
Boolean Fields
{
"is_new_bool": true,
"is_sale_bool": false,
"has_warranty_bool": true
}Use for: Feature flags, status indicators.
Text Fields
{
"brand_str_short": "Nike",
"product_line_str_short": "Air Max",
"description_str_long": "This premium sneaker features..."
}*_str_short: For short, searchable text (brand names, categories)*_str_long: For longer descriptions with full-text search
Compound Word Fields (German)
{
"produktname_str_decomposed": "Kinderwagen"
}The decomposed suffix enables German compound word splitting:
- "Kinderwagen" → searchable as "Kinder", "Wagen", "Kinderwagen"
Keyword Fields
{
"sku_str_keyword": "ABC-123-XYZ",
"color_code_str_keyword": "#FF5733"
}Use for: Exact match only, no text analysis.
Product Code Fields
{
"article_number_split_number_string": "ABC-123-DEF-456"
}Splits on delimiters for partial matching:
- Searchable as "ABC", "123", "DEF", "456"
Data-Only Fields
{
"internal_notes_data_only": "Warehouse location: A-12-3",
"erp_metadata_data_only": {
"supplier_id": "SUP-001",
"cost_center": "CC-100"
}
}Stored but not indexed - useful for data you need to retrieve but never search.
Price Fields
Any field containing price in the name is automatically mapped as double:
{
"price": 99.99,
"original_price": 129.99,
"wholesale_price": 49.99,
"price_per_unit": 2.50
}Field Sub-Fields
Most dynamic fields automatically get these sub-fields:
| Sub-Field | Type | Purpose |
|---|---|---|
.unanalyzed | keyword | Exact term matching |
.lowercase | keyword | Case-insensitive matching |
.sorting | keyword | Alphabetical sorting |
Example Usage in Filters
{
"filter": {
"term": {
"brand_str_short.unanalyzed": "Nike"
}
}
}Best Practices
-
Use consistent naming - Establish a convention for your custom fields.
-
Choose the right suffix - Match the suffix to your data type and search needs.
-
Use
_data_onlyfor internal data - Don't index fields you'll never search. -
Use
_str_decomposedfor German - Enable compound word search for German content. -
Test your fields - Use the Data Inspector to verify field indexing.
Updated about 14 hours ago
