Path Matching in Objects

Spatialized founder Jozef Sorocin
Jozef Soročin
Book a consultation ↗
3 min read  •  Updated 07/13/2025
{
  "attrs": {
    "useless_key": "jibber_jabber",

    "batch": {
      "created_at": 1605443039,
      "id": "batch_1213"
    },

    "session": {
      "created_at": 1605443039,
      "tags": ["affiliate_1", "checkout"]
    }
  }
}

with potentially lots of currently unknown attrs.* sub-objects.


I want to map all attrs.*.created_at fields as timestamps and the rest (attrs.*.*) as keywords.

At the same time, I want to set index: false on everything else inside attrs to not make it searchable.

Let's use dynamic_templates with path_match and path_unmatch.

Join 200+ developers who've mastered this! Get Lifetime Access — $5
Already a member? Sign in here