Path Matching in Objects

🏡 Home 📖 Chapter Home 👉 Next
⚡ is crafted by Jozef Sorocin and powered by:

Use Case

My document is an object of objects
  "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.

Already purchased? Sign in here.