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

SuffixElasticsearch TypeUse Case
*_datedateDate/time values
*_floatfloatDecimal numbers
*_intinteger/longWhole numbers
*_boolbooleanTrue/false values
*_str_shorttext + keywordShort text (names, codes)
*_str_longtextLong text (descriptions)
*_str_decomposedtextCompound words (German)
*_str_keywordkeywordExact match only
*_split_number_stringtextProduct codes with delimiters
*_split_everywheretextSplit on all delimiters
*_data_onlydisabledStorage 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-FieldTypePurpose
.unanalyzedkeywordExact term matching
.lowercasekeywordCase-insensitive matching
.sortingkeywordAlphabetical sorting

Example Usage in Filters

{
  "filter": {
    "term": {
      "brand_str_short.unanalyzed": "Nike"
    }
  }
}

Best Practices

  1. Use consistent naming - Establish a convention for your custom fields.

  2. Choose the right suffix - Match the suffix to your data type and search needs.

  3. Use _data_only for internal data - Don't index fields you'll never search.

  4. Use _str_decomposed for German - Enable compound word search for German content.

  5. Test your fields - Use the Data Inspector to verify field indexing.